about summary refs log tree commit diff
path: root/NEWS
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2014-01-16 10:20:22 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2014-01-16 10:21:52 +0530
commit980cb5180e1b71224a57ca52b995c959b7148c09 (patch)
tree132d22c6a5d1ea9993dcc3bf721f089b40857e49 /NEWS
parent2393fc0119fa291ff01b7b912dda2069257c8600 (diff)
downloadglibc-980cb5180e1b71224a57ca52b995c959b7148c09.tar.gz
glibc-980cb5180e1b71224a57ca52b995c959b7148c09.tar.xz
glibc-980cb5180e1b71224a57ca52b995c959b7148c09.zip
Don't use alloca in addgetnetgrentX (BZ #16453)
addgetnetgrentX has a buffer which is grown as per the needs of the
requested size either by using alloca or by falling back to malloc if
the size is larger than 1K.  There are two problems with the alloca
bits: firstly, it doesn't really extend the buffer since it does not
use the return value of the extend_alloca macro, which is the location
of the reallocated buffer.  Due to this the buffer does not actually
extend itself and hence a subsequent write may overwrite stuff on the
stack.

The second problem is more subtle - the buffer growth on the stack is
discontinuous due to block scope local variables.  Combine that with
the fact that unlike realloc, extend_alloca does not copy over old
content and you have a situation where the buffer just has garbage in
the space where it should have had data.

This could have been fixed by adding code to copy over old data
whenever we call extend_alloca, but it seems unnecessarily
complicated.  This code is not exactly a performance hotspot (it's
called when there is a cache miss, so factors like network lookup or
file reads will dominate over memory allocation/reallocation), so this
premature optimization is unnecessary.

Thanks Brad Hubbard <bhubbard@redhat.com> for his help with debugging
the problem.
Diffstat (limited to 'NEWS')
-rw-r--r--NEWS2
1 files changed, 1 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index f406522882..248f2c30ad 100644
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@ Version 2.19
   16151, 16153, 16167, 16172, 16195, 16214, 16245, 16271, 16274, 16283,
   16289, 16293, 16314, 16316, 16330, 16337, 16338, 16356, 16365, 16366,
   16369, 16372, 16375, 16379, 16384, 16385, 16386, 16387, 16390, 16394,
-  16400, 16407, 16408, 16414.
+  16400, 16407, 16408, 16414, 16453.
 
 * Slovenian translations for glibc messages have been contributed by the
   Translation Project's Slovenian team of translators.