Re: problem with GNU C
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).
Wichert.
--
_________________________________________________________________
/ Nothing is fool-proof to a sufficiently talented fool \
| wichert@wiggy.net http://www.liacs.nl/~wichert/ |
| 1024D/2FA3BC2D 576E 100B 518D 2F16 36B0 2805 3CB8 9250 2FA3 BC2D |
Reply to: