I get an invalid memory error in the following code:
printf(" %s\n","FINE 5"); printf("%s LENGTH IS: %d\n","FINE 6",strlen(": ")); buffer = (char *)realloc(buffer, strlen(buffer)* sizeof(char) + (strlen(": ")+1)* sizeof(char)); printf(" %s\n","FINE 7"); strcat(buffer, ": \0");
Output:
FINE 5
FINE 6 LENGTH: 2
* glibc detected * ./auto: realloc (): invalid following size: 0x08cd72e0 *** ======= Backtrace: ========= / lib / tls / i686 / cmov / libc.so .6 (+ 0x6b591) [0x6dd591]
Fine 7 should be noted here. and an incorrect error of the following size at each start is in the same place.
Found this relavent
c string malloc realloc strcat
PUG
source share