1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 16:42:56 -08:00

terminate the buffer before calling regexec(3) when prompting for

confirmation. fixes a crash with malloc options; otto@ ok.
This commit is contained in:
fgsch 2005-09-26 20:32:04 +00:00
parent 40dd85304c
commit 39c003f832

View File

@ -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);