[Info-vax] calloc fails with access violation

JF Mezei jfmezei.spamnot at vaxination.ca
Wed Aug 26 14:42:48 EDT 2009


Jose Cuevas wrote:

>         for(i=strlen(str);i>=0; i--){
>                 if(str[i] == '\0'){
>                         /*should never happen*/
>                         printf("ch[%i]=[NULL][NULL]\n", i);

If you have the following:

i = "SEX";


then strlen(i) will yield 3.

i[0] = 'S'
i[1] = 'E'
i[2] = 'X'
i[3] = 0x00

So in the above, you start off with  str[strlen(str0]  which points to
the null byte at the end.



More information about the Info-vax mailing list