summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/regex/main.c
diff options
context:
space:
mode:
authorchl <>2007-09-09 23:25:12 +0000
committerchl <>2007-09-09 23:25:12 +0000
commit3fdd26c169b3cd992ae051f07bcbe76bc5a6bc85 (patch)
tree0fd4c691bd6eccb1a0180a5c679de3f12245f267 /src/regress/lib/libc/regex/main.c
parente2606853a9c2dc9a603cb97d0e8f2d33d384116d (diff)
downloadopenbsd-3fdd26c169b3cd992ae051f07bcbe76bc5a6bc85.tar.gz
openbsd-3fdd26c169b3cd992ae051f07bcbe76bc5a6bc85.tar.bz2
openbsd-3fdd26c169b3cd992ae051f07bcbe76bc5a6bc85.zip
use strcspn to properly overwrite '\n' in fgets returned buffer
ok moritz@ gilles@
Diffstat (limited to 'src/regress/lib/libc/regex/main.c')
-rw-r--r--src/regress/lib/libc/regex/main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/regress/lib/libc/regex/main.c b/src/regress/lib/libc/regex/main.c
index fd092905fa..15e0bc8c1f 100644
--- a/src/regress/lib/libc/regex/main.c
+++ b/src/regress/lib/libc/regex/main.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: main.c,v 1.5 2004/02/28 08:06:46 deraadt Exp $ */ 1/* $OpenBSD: main.c,v 1.6 2007/09/09 23:25:12 chl Exp $ */
2/* $NetBSD: main.c,v 1.2 1995/04/20 22:39:51 cgd Exp $ */ 2/* $NetBSD: main.c,v 1.2 1995/04/20 22:39:51 cgd Exp $ */
3 3
4#include <stdio.h> 4#include <stdio.h>
@@ -147,7 +147,7 @@ FILE *in;
147 line++; 147 line++;
148 if (inbuf[0] == '#' || inbuf[0] == '\n') 148 if (inbuf[0] == '#' || inbuf[0] == '\n')
149 continue; /* NOTE CONTINUE */ 149 continue; /* NOTE CONTINUE */
150 inbuf[strlen(inbuf)-1] = '\0'; /* get rid of stupid \n */ 150 inbuf[strcspn(inbuf, "\n")] = '\0'; /* get rid of stupid \n */
151 if (debug) 151 if (debug)
152 fprintf(stdout, "%d:\n", line); 152 fprintf(stdout, "%d:\n", line);
153 nf = split(inbuf, f, MAXF, "\t\t"); 153 nf = split(inbuf, f, MAXF, "\t\t");