summaryrefslogtreecommitdiff
path: root/usr.sbin/inetd/inetd.c
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2007-09-11 16:31:00 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2007-09-11 16:31:00 +0000
commita8152da22f218d42cf3e2467c979fd1b1b487943 (patch)
tree56bcdad1b11232f055be50d69dd3cc079d74a75a /usr.sbin/inetd/inetd.c
parent25679492194cdf74e631b94ff0156ca727ed97f0 (diff)
use strcspn to properly overwrite '\n' in fgets returned buffer
ok pyr@, ray@, millert@, moritz@, chl@
Diffstat (limited to 'usr.sbin/inetd/inetd.c')
-rw-r--r--usr.sbin/inetd/inetd.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index b7849e882dc..7c36c3dfc25 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inetd.c,v 1.123 2005/04/02 18:10:52 otto Exp $ */
+/* $OpenBSD: inetd.c,v 1.124 2007/09/11 16:30:59 gilles Exp $ */
/*
* Copyright (c) 1983,1991 The Regents of the University of California.
@@ -37,7 +37,7 @@ char copyright[] =
#ifndef lint
/*static const char sccsid[] = "from: @(#)inetd.c 5.30 (Berkeley) 6/3/91";*/
-static const char rcsid[] = "$OpenBSD: inetd.c,v 1.123 2005/04/02 18:10:52 otto Exp $";
+static const char rcsid[] = "$OpenBSD: inetd.c,v 1.124 2007/09/11 16:30:59 gilles Exp $";
#endif /* not lint */
/*
@@ -1494,13 +1494,9 @@ again:
char *
nextline(FILE *fd)
{
- char *cp;
-
if (fgets(line, sizeof (line), fd) == NULL)
return (NULL);
- cp = strchr(line, '\n');
- if (cp)
- *cp = '\0';
+ line[strcspn(line, "\n")] = '\0';
return (line);
}