File nss-files-long-lines.patch of Package glibc.i686

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.

Index: glibc-2.19/nss/nss_files/files-XXX.c
===================================================================
--- glibc-2.19.orig/nss/nss_files/files-XXX.c
+++ glibc-2.19/nss/nss_files/files-XXX.c
@@ -198,10 +198,12 @@ get_contents (char *linebuf, size_t len,
     {
       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;
openSUSE Build Service is sponsored by