summaryrefslogtreecommitdiff
path: root/sbin/routed/parms.c
diff options
context:
space:
mode:
authorMoritz Jodeit <moritz@cvs.openbsd.org>2006-10-24 19:44:30 +0000
committerMoritz Jodeit <moritz@cvs.openbsd.org>2006-10-24 19:44:30 +0000
commit4c9079809afe8b1e1e669f3d019fb58d36359103 (patch)
treebfe9ad35b2e1840d42725cda8dacf995ebad67ad /sbin/routed/parms.c
parent2562ded1b50d5a3b821ecf8fc66178d378f3bf02 (diff)
Ignore NUL lines returned by fgets(3), so we don't
access one byte before the lbuf buffer. OK cloder@ henning@
Diffstat (limited to 'sbin/routed/parms.c')
-rw-r--r--sbin/routed/parms.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sbin/routed/parms.c b/sbin/routed/parms.c
index af86599b2f5..f5f70de2b27 100644
--- a/sbin/routed/parms.c
+++ b/sbin/routed/parms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parms.c,v 1.13 2005/04/12 15:26:47 cloder Exp $ */
+/* $OpenBSD: parms.c,v 1.14 2006/10/24 19:44:29 moritz Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -145,13 +145,13 @@ gwkludge(void)
return;
for (;;) {
- if (0 == fgets(lbuf, sizeof(lbuf)-1, fp))
+ if (fgets(lbuf, sizeof(lbuf)-1, fp) == NULL)
break;
lptr = lbuf;
while (*lptr == ' ')
lptr++;
- if (*lptr == '\n' /* ignore null and comment lines */
- || *lptr == '#')
+ /* ignore null and comment lines */
+ if (*lptr == '\0' || *lptr == '\n' || *lptr == '#')
continue;
p = lptr+strlen(lptr)-1;
while (*p == '\n'