From ac60763eac3d43b7234dd21286ad3ec3f17957fc Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 23 Jun 2014 10:24:45 +0200 Subject: Don't ignore too long lines in nss_files (BZ #17079) --- nss/nss_files/files-XXX.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nss/nss_files') diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c index 00b2ecf..212b938 100644 --- a/nss/nss_files/files-XXX.c +++ b/nss/nss_files/files-XXX.c @@ -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; -- cgit v1.1