Linux Programming Discussions

Christopher Brannon cmbrannon79 at gmail.com
Tue Aug 31 21:37:51 UTC 2010


> I also suspect that if read reads sizeof(buf) bytes and then you set
> buf[sizeof(buf)] = 0 you will possibly touch memory that isn't yours.

Yep, this is a buffer overrun.  Additionally, the OP isn't
checking the return value of read().  It returns -1 on failure, in which
case, it should not be used as an index into the buffer.

-- Chris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/blinux-list/attachments/20100831/6674ccfa/attachment.sig>


More information about the Blinux-list mailing list