[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: problem with GNU C



From: "Wichert Akkerman" <wichert@wiggy.net>
> Previously Ilya Teterin wrote:
> > Are you really believe that program crashed because the length of
> > one string was equal (not less and not greater) than 1024? Additionally,
I
> > believe that even if it occurs, it will not crash the program...
>
> Sure it can, if you try to strcpy a string that is not properly NUL
> terminated strcpy will happily try to access memory that might not
> be readable and cause a segfault. Even strlen has that problem,
> which makes strnlen a very useful thing to use at times.
>
> (please note I haven't looked at the code so I'm not sure if that is
> the case in this particular example).

If you read my previous letters, you can see that was NO segmentation fault,
the program just died with no reason.




Reply to: