Re: Linux Programming Discussions

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

 



> 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

Attachment: pgp4nmASzbAgP.pgp
Description: PGP signature

_______________________________________________
Blinux-list mailing list
Blinux-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/blinux-list

[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]