#include #include #include #include typedef void *(*malloc_t)(size_t size); static malloc_t real_malloc; extern void *malloc (size_t size) { if (!real_malloc) real_malloc = dlsym (RTLD_NEXT, "malloc"); if (!real_malloc) return NULL; // lmao srand (time (NULL)); int val = (rand () % 2)+1; if (val > 1) { long loss = (rand () % (int) size)+5; return real_malloc (size - loss); } else { return real_malloc (size); } }