From 66f1feaba386265cf8a33c7d9a931790676f7c35 Mon Sep 17 00:00:00 2001 From: jdolecek Date: Mon, 2 Dec 2002 22:08:44 +0000 Subject: [PATCH] avoid endless loop in xgets() when line in host access conf file is longer than BUFSIZ fixes PR lib/15025 by Trevin Beattie --- lib/libwrap/misc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libwrap/misc.c b/lib/libwrap/misc.c index 93288cd1b65f..65e2c144cb35 100644 --- a/lib/libwrap/misc.c +++ b/lib/libwrap/misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.8 2002/05/24 05:38:20 itojun Exp $ */ +/* $NetBSD: misc.c,v 1.9 2002/12/02 22:08:44 jdolecek Exp $ */ /* * Misc routines that are used by tcpd and by tcpdchk. @@ -11,7 +11,7 @@ #if 0 static char sccsic[] = "@(#) misc.c 1.2 96/02/11 17:01:29"; #else -__RCSID("$NetBSD: misc.c,v 1.8 2002/05/24 05:38:20 itojun Exp $"); +__RCSID("$NetBSD: misc.c,v 1.9 2002/12/02 22:08:44 jdolecek Exp $"); #endif #endif @@ -34,7 +34,7 @@ FILE *fp; int got; char *start = ptr; - while (fgets(ptr, len, fp)) { + while (len > 1 && fgets(ptr, len, fp)) { got = strlen(ptr); if (got >= 1 && ptr[got - 1] == '\n') { tcpd_context.line++;