summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Longeau <chl@cvs.openbsd.org>2007-09-25 11:20:35 +0000
committerCharles Longeau <chl@cvs.openbsd.org>2007-09-25 11:20:35 +0000
commit379821d4ca338301b1ad7910948dbcdbd7713806 (patch)
treeb7ae2fc8cb2f93190f107d0b30281f767b326c46
parent09944c345be5ccdda2b0574ccea1f177d2d91e49 (diff)
handle empty strings returned by fgets
ok ray@
-rw-r--r--usr.bin/split/split.c7
-rw-r--r--usr.sbin/authpf/authpf.c4
-rw-r--r--usr.sbin/ppp/ppp/radlib.c5
3 files changed, 11 insertions, 5 deletions
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c
index 4f4a9653b13..eea4ae8fa47 100644
--- a/usr.bin/split/split.c
+++ b/usr.bin/split/split.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: split.c,v 1.14 2007/09/05 21:07:53 millert Exp $ */
+/* $OpenBSD: split.c,v 1.15 2007/09/25 11:20:34 chl Exp $ */
/* $NetBSD: split.c,v 1.5 1995/08/31 22:22:05 jtc Exp $ */
/*
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)split.c 8.3 (Berkeley) 4/25/94";
#else
-static char rcsid[] = "$OpenBSD: split.c,v 1.14 2007/09/05 21:07:53 millert Exp $";
+static char rcsid[] = "$OpenBSD: split.c,v 1.15 2007/09/25 11:20:34 chl Exp $";
#endif
#endif /* not lint */
@@ -244,6 +244,9 @@ split2(void)
while (fgets(bfr, sizeof(bfr), infp) != NULL) {
const int len = strlen(bfr);
+ if (len == 0)
+ continue;
+
/* If line is too long to deal with, just write it out */
if (bfr[len - 1] != '\n')
goto writeit;
diff --git a/usr.sbin/authpf/authpf.c b/usr.sbin/authpf/authpf.c
index 68adcd258ee..c60197594d0 100644
--- a/usr.sbin/authpf/authpf.c
+++ b/usr.sbin/authpf/authpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authpf.c,v 1.104 2007/02/24 17:35:08 beck Exp $ */
+/* $OpenBSD: authpf.c,v 1.105 2007/09/25 11:20:34 chl Exp $ */
/*
* Copyright (C) 1998 - 2007 Bob Beck (beck@openbsd.org).
@@ -349,6 +349,8 @@ read_config(FILE *f)
}
i++;
len = strlen(buf);
+ if (len == 0)
+ continue;
if (buf[len - 1] != '\n' && !feof(f)) {
syslog(LOG_ERR, "line %d too long in %s", i,
PATH_CONFFILE);
diff --git a/usr.sbin/ppp/ppp/radlib.c b/usr.sbin/ppp/ppp/radlib.c
index 681d3fcf5d4..e7038ded2a7 100644
--- a/usr.sbin/ppp/ppp/radlib.c
+++ b/usr.sbin/ppp/ppp/radlib.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: radlib.c,v 1.8 2003/04/04 20:25:06 deraadt Exp $
+ * $OpenBSD: radlib.c,v 1.9 2007/09/25 11:20:34 chl Exp $
*/
#include <sys/types.h>
@@ -320,7 +320,8 @@ rad_config(struct rad_handle *h, const char *path)
linenum++;
len = strlen(buf);
- /* We know len > 0, else fgets would have returned NULL. */
+ if (len == 0)
+ continue;
if (buf[len - 1] != '\n') {
if (len == sizeof buf - 1)
generr(h, "%s:%d: line too long", path,