summaryrefslogtreecommitdiff
path: root/usr.bin/xargs/xargs.c
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2005-09-26 20:32:05 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2005-09-26 20:32:05 +0000
commitbf3d09833861afd8ec9f911ca5b767841069a234 (patch)
tree2d93392c2e8f8fb7fd69229b124ef8b5ab9f2c1c /usr.bin/xargs/xargs.c
parent2342f7c7dc3a07128b99d6b670959110efd6b196 (diff)
terminate the buffer before calling regexec(3) when prompting for
confirmation. fixes a crash with malloc options; otto@ ok.
Diffstat (limited to 'usr.bin/xargs/xargs.c')
-rw-r--r--usr.bin/xargs/xargs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c
index 411ade10159..56318a6d990 100644
--- a/usr.bin/xargs/xargs.c
+++ b/usr.bin/xargs/xargs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xargs.c,v 1.22 2005/09/12 09:44:59 jmc Exp $ */
+/* $OpenBSD: xargs.c,v 1.23 2005/09/26 20:32:04 fgsch Exp $ */
/* $FreeBSD: xargs.c,v 1.51 2003/05/03 19:09:11 obrien Exp $ */
/*-
@@ -45,7 +45,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)xargs.c 8.1 (Berkeley) 6/6/93";
#else
-static const char rcsid[] = "$OpenBSD: xargs.c,v 1.22 2005/09/12 09:44:59 jmc Exp $";
+static const char rcsid[] = "$OpenBSD: xargs.c,v 1.23 2005/09/26 20:32:04 fgsch Exp $";
#endif
#endif /* not lint */
@@ -609,6 +609,7 @@ prompt(void)
(void)fclose(ttyfp);
return (0);
}
+ response[rsize - 1] = '\0';
match = regexec(&cre, response, 0, NULL, 0);
(void)fclose(ttyfp);
regfree(&cre);