From c41cd4bf35f4da7e4e9e2f36779c90ddbc25640b Mon Sep 17 00:00:00 2001 From: das Date: Tue, 15 Jan 2008 06:50:50 +0000 Subject: In getttyent(3), if /etc/ttys doesn't end in a newline, don't freak out and keep trying to expand the buffer until realloc() fails. PR: 114398 --- lib/libc/gen/getttyent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libc') diff --git a/lib/libc/gen/getttyent.c b/lib/libc/gen/getttyent.c index 8249fad..efc4c9b 100644 --- a/lib/libc/gen/getttyent.c +++ b/lib/libc/gen/getttyent.c @@ -97,7 +97,7 @@ getttyent() return (NULL); } /* extend buffer if line was too big, and retry */ - while (!index(p, '\n')) { + while (!index(p, '\n') && !feof(tf)) { i = strlen(p); lbsize += MALLOCCHUNK; if ((p = realloc(line, lbsize)) == NULL) { -- cgit v1.1