summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2008-01-15 06:50:50 +0000
committerdas <das@FreeBSD.org>2008-01-15 06:50:50 +0000
commitc41cd4bf35f4da7e4e9e2f36779c90ddbc25640b (patch)
treeb33232a651fe230bf4e3f7db42d7faa55edc3378
parent24232b615d41fb5e5e7a5ee56691f4caeacdf216 (diff)
downloadFreeBSD-src-c41cd4bf35f4da7e4e9e2f36779c90ddbc25640b.zip
FreeBSD-src-c41cd4bf35f4da7e4e9e2f36779c90ddbc25640b.tar.gz
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
-rw-r--r--lib/libc/gen/getttyent.c2
1 files changed, 1 insertions, 1 deletions
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) {
OpenPOWER on IntegriCloud