[LLVMdev] Another memory fun

Török Edwin edwintorok at gmail.com
Sun Jan 6 12:33:21 PST 2008


Zalunin Pavel wrote:
> hm.... I think, that is valid in c
> [...]
> but next code too doesn't works right:
> I tried decompile code:
>  main(int argc, char **argv) {
>   char str1[] = "mother ";
>   strcat(str1, "father");
>   return 0;
> }
>

Valid C doesn't mean only that it compiles, but also that you are
properly using library functions.
Consult the manpage for strcat(3): "the dest string  must have enough
space for the result";
in your example it doesn't have.

Best regards,
--Edwin




More information about the llvm-dev mailing list