summaryrefslogtreecommitdiffstats
path: root/usr.bin/apply
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>1999-12-04 02:19:33 +0000
committerkris <kris@FreeBSD.org>1999-12-04 02:19:33 +0000
commit3e5c0ef8dce8cdadef52b5faa0a0c6dd2c8d1585 (patch)
tree5969b742eb04bd2e485ddb20d5db2fded08d0d1e /usr.bin/apply
parent370aed25b5eaeeea8dee4ab12adcb85c279dc001 (diff)
downloadFreeBSD-src-3e5c0ef8dce8cdadef52b5faa0a0c6dd2c8d1585.zip
FreeBSD-src-3e5c0ef8dce8cdadef52b5faa0a0c6dd2c8d1585.tar.gz
Fix off-by-one error leading to a segfault.
Noticed by: Thomas Stromberg <tstromberg@rtci.com>
Diffstat (limited to 'usr.bin/apply')
-rw-r--r--usr.bin/apply/apply.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/apply/apply.c b/usr.bin/apply/apply.c
index 5499bec..dfb738a 100644
--- a/usr.bin/apply/apply.c
+++ b/usr.bin/apply/apply.c
@@ -35,7 +35,11 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)apply.c 8.4 (Berkeley) 4/4/94";
+#endif
+static const char rcsid[] =
+ "$FreeBSD$";
#endif /* not lint */
#include <sys/wait.h>
@@ -152,7 +156,7 @@ main(argc, argv)
* there's enough space to build it.
*/
for (l = strlen(cmd), i = 0; i < nargs; i++)
- l += strlen(argv[i]);
+ l += strlen(argv[i+1]);
if (l > clen && (c = realloc(c, clen = l)) == NULL)
err(1, NULL);
OpenPOWER on IntegriCloud