]> git.ipfire.org Git - thirdparty/glibc.git/commit
Fix reads for sizes larger than INT_MAX in AF_INET lookup
authorSiddhesh Poyarekar <siddhesh@redhat.com>
Wed, 30 Oct 2013 10:43:37 +0000 (16:13 +0530)
committerSiddhesh Poyarekar <siddhesh@redhat.com>
Wed, 30 Oct 2013 10:49:40 +0000 (16:19 +0530)
commit977f4b31b7ca4a4e498c397f3fd70510694bbd86
tree4f53a0fdb7ea94f487d26f9df0b658e0b14ff64b
parent66925c47793852d1a8423cd25ab78d7dabdf5924
Fix reads for sizes larger than INT_MAX in AF_INET lookup

Currently for AF_INET lookups from the hosts file, buffer sizes larger
than INT_MAX silently overflow and may result in access beyond bounds
of a buffer.  This happens when the number of results in an AF_INET
lookup in /etc/hosts are very large.

There are two aspects to the problem.  One problem is that the size
computed from the buffer size is stored into an int, which results in
overflow for large sizes.  Additionally, even if this size was
expanded, the function used to read content into the buffer (fgets)
accepts only int sizes.  As a result, the fix is to have a function
wrap around fgets that calls it multiple times with int sizes if
necessary.
ChangeLog
NEWS
nss/nss_files/files-XXX.c