From f604ab72a14592610b3886c1966659986b33f5fc Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Tue, 17 Mar 2009 19:46:52 +0800 Subject: [PATCH] tcp_wrapper: Make sure that the buf has more than 1byte, before calling fgets() FreeBSD-PR: kern/132705 Obtained-from: OpenBSD --- contrib/tcp_wrappers/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/tcp_wrappers/misc.c b/contrib/tcp_wrappers/misc.c index b6bf5cb99d..8b88eaa36b 100644 --- a/contrib/tcp_wrappers/misc.c +++ b/contrib/tcp_wrappers/misc.c @@ -36,7 +36,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++; -- 2.41.0