summaryrefslogtreecommitdiffstats
path: root/lib/libwrap/misc.c
diff options
context:
space:
mode:
authorpjanzen <pjanzen@openbsd.org>2003-05-15 04:45:28 +0000
committerpjanzen <pjanzen@openbsd.org>2003-05-15 04:45:28 +0000
commitbd99e19d7d9016401edc3f0c0eb154690d50cd2e (patch)
tree36c17884ed4b4eb84631afeabe39862530454b27 /lib/libwrap/misc.c
parentfirst sprintf test: positional args (diff)
downloadwireguard-openbsd-bd99e19d7d9016401edc3f0c0eb154690d50cd2e.tar.xz
wireguard-openbsd-bd99e19d7d9016401edc3f0c0eb154690d50cd2e.zip
NetBSD PR 15025: libwrap hangs in an infinite loop when a host access line
is > 2048 characters long. ok millert a long time ago.
Diffstat (limited to 'lib/libwrap/misc.c')
-rw-r--r--lib/libwrap/misc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libwrap/misc.c b/lib/libwrap/misc.c
index 8c5294cc795..b0573286160 100644
--- a/lib/libwrap/misc.c
+++ b/lib/libwrap/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.5 2002/06/07 03:32:04 itojun Exp $ */
+/* $OpenBSD: misc.c,v 1.6 2003/05/15 04:45:28 pjanzen Exp $ */
/*
* Misc routines that are used by tcpd and by tcpdchk.
@@ -10,7 +10,7 @@
#if 0
static char sccsic[] = "@(#) misc.c 1.2 96/02/11 17:01:29";
#else
-static char rcsid[] = "$OpenBSD: misc.c,v 1.5 2002/06/07 03:32:04 itojun Exp $";
+static char rcsid[] = "$OpenBSD: misc.c,v 1.6 2003/05/15 04:45:28 pjanzen Exp $";
#endif
#endif
@@ -33,7 +33,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++;