This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New read etc. checking macros


> 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.

Does the gcc magic handle cases like:

struct {
  uint32_t magic;
  char foo[3];
  char bar[27];
} record;

if (read(fd, &record.magic, sizeof record.magic) == sizeof record.magic &&
    record.magic == 0x1234567)
  n = read(fd, &record.foo, sizeof record - (&record.foo - (char*)&record));

i.e., so __bos yields 30 rather than 3?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]