New read etc. checking macros

Jakub Jelinek jakub@redhat.com
Sat Feb 26 00:08:00 GMT 2005


On Fri, Feb 25, 2005 at 03:29:58PM -0800, Roland McGrath wrote:
> I can imagine reading POSIX to say that this is not in fact invoked
> undefined behavior when there is some external guarantee such as the
> program knowing that the file being read contains no more than 10 bytes.
> The standard C functions' specifications talk more explicitly about an
> array (for e.g. fgets and fread), so the strict reading might not be as
> permissive for those as for the POSIX functions like read.  Regardless,
> this is desireable checking for the way people usually write their programs.
> Perhaps it should be done only at _FORTIFY_SOURCE >= 2.

Yeah, I think we can only protect read etc. with _FORTIFY_SOURCE >= 2
which has some limitations against POSIX and not allowing bigger len
than the buffer that is provided is reasonable limitation.

	Jakub



More information about the Libc-hacker mailing list