1 #include <string.h> 2 #include <stdio.h> 3 main()4int main() { 5 char * src = "somestring"; 6 char dest[20] = {0}; 7 if(strlen(src) < sizeof(dest)-1) { 8 char * newptr = strcpy(dest, src); 9 if(!newptr) { 10 printf("strcpy failed!\n"); 11 } else { 12 printf("Copied string!\n"); 13 } 14 } 15 } 16 17 // gcc -Wall -o test_preload test_preload.c 18 // LD_PRELOAD=./strcpy_lib.so ./test_preload 19