1

LD_PRELOADed libraries and child process

view story
linux-howto

http://stackoverflow.com – everyone! Image that i have a program(usemalloc) like this: #include <stdio.h> #include <stdlib.h> #define USER_BYTES_SIZE 100 int main(void){ char* userbytes = (char*)malloc(USER_BYTES_SIZE*sizeof(char)); if(!userbytes) return 1; for(int i = 0; i <= USER_BYTES_SIZE; i++){ // "i <= USER_BYTES_SIZE" leads to an off-by-one memory overrun. userbytes[i] = 0; } return 0; } As you see that, there is an off-by-one bug which leads to a memory overflow. I want to detect such bugs at runtime. LD_PRELOADed libraries are proper to do my work. I (HowTos)