]> sourceware.org Git - glibc.git/commitdiff
Don't ignore too long lines in nss_files (BZ #17079)
authorAndreas Schwab <schwab@suse.de>
Mon, 23 Jun 2014 08:24:45 +0000 (10:24 +0200)
committerAndreas Schwab <schwab@suse.de>
Mon, 23 Jun 2014 10:29:51 +0000 (12:29 +0200)
ChangeLog
NEWS
nss/nss_files/files-XXX.c

index 11232dfe8ff1052d91bf1582511bc31271e0abe1..28f477157a49fac4ccedb780662c3eddfc2fd91d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-23  Andreas Schwab  <schwab@suse.de>
+
+       [BZ #17079]
+       * nss/nss_files/files-XXX.c (get_contents): Store overflow marker
+       before reading the next line.
+
 2014-06-23  Will Newton  <will.newton@linaro.org>
 
        * test-skeleton.c (signal_handler): Use printf and %m
diff --git a/NEWS b/NEWS
index 8d08cd5cd747fa664a041ac6dda7c66f0b3d080b..b0d5ab2b7c6015b7bd7c38a0f293ce1e27e77ffc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -20,7 +20,7 @@ Version 2.20
   16854, 16876, 16877, 16878, 16882, 16885, 16888, 16890, 16912, 16915,
   16916, 16917, 16922, 16927, 16928, 16932, 16943, 16958, 16965, 16966,
   16967, 16977, 16978, 16984, 16990, 16996, 17009, 17022, 17031, 17042,
-  17048, 17058, 17062, 17069, 17075.
+  17048, 17058, 17062, 17069, 17075, 17079.
 
 * Optimized strchr implementation for AArch64.  Contributed by ARM Ltd.
 
index 00b2ecf612a91ae0f9793dba60f46d57db221d6e..212b938fdf39a4b6a048088b301a2db7c9f6ccec 100644 (file)
@@ -198,10 +198,12 @@ get_contents (char *linebuf, size_t len, FILE *stream)
     {
       int curlen = ((remaining_len > (size_t) INT_MAX) ? INT_MAX
                    : remaining_len);
-      char *p = fgets_unlocked (curbuf, curlen, stream);
 
+      /* Terminate the line so that we can test for overflow.  */
       ((unsigned char *) curbuf)[curlen - 1] = 0xff;
 
+      char *p = fgets_unlocked (curbuf, curlen, stream);
+
       /* EOF or read error.  */
       if (p == NULL)
         return gcr_error;
This page took 0.139832 seconds and 5 git commands to generate.