summaryrefslogtreecommitdiffstats
path: root/regress/lib/libc/regex/main.c
diff options
context:
space:
mode:
authorchl <chl@openbsd.org>2007-09-09 23:25:12 +0000
committerchl <chl@openbsd.org>2007-09-09 23:25:12 +0000
commit2ed2be6ef3e74cfc0d72db1624a4eb9350fc819e (patch)
treeec10a9cf36a046df83179249d891e81501553b1b /regress/lib/libc/regex/main.c
parentMake sure ptrace(2) cannot change any priviliged bits in the Machine State (diff)
downloadwireguard-openbsd-2ed2be6ef3e74cfc0d72db1624a4eb9350fc819e.tar.xz
wireguard-openbsd-2ed2be6ef3e74cfc0d72db1624a4eb9350fc819e.zip
use strcspn to properly overwrite '\n' in fgets returned buffer
ok moritz@ gilles@
Diffstat (limited to 'regress/lib/libc/regex/main.c')
-rw-r--r--regress/lib/libc/regex/main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/regress/lib/libc/regex/main.c b/regress/lib/libc/regex/main.c
index fd092905faf..15e0bc8c1f8 100644
--- a/regress/lib/libc/regex/main.c
+++ b/regress/lib/libc/regex/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.5 2004/02/28 08:06:46 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.6 2007/09/09 23:25:12 chl Exp $ */
/* $NetBSD: main.c,v 1.2 1995/04/20 22:39:51 cgd Exp $ */
#include <stdio.h>
@@ -147,7 +147,7 @@ FILE *in;
line++;
if (inbuf[0] == '#' || inbuf[0] == '\n')
continue; /* NOTE CONTINUE */
- inbuf[strlen(inbuf)-1] = '\0'; /* get rid of stupid \n */
+ inbuf[strcspn(inbuf, "\n")] = '\0'; /* get rid of stupid \n */
if (debug)
fprintf(stdout, "%d:\n", line);
nf = split(inbuf, f, MAXF, "\t\t");