summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-12-01 18:25:16 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-12-01 18:25:16 +0000
commite6464924300d1beeda851b774772b773e7674504 (patch)
treef63acbb4ef901d334d480acba2726b34b2381bfb /bin
parent60f9c98bd1a2fb23a10fb22a7d9fcbb8fbdb5b32 (diff)
Truncate the source string before copying during variable substitution
so we copy the correct number of bytes. Fixes a bug introduced in revision 1.11. Closes PR 3591
Diffstat (limited to 'bin')
-rw-r--r--bin/csh/dol.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/csh/dol.c b/bin/csh/dol.c
index 2d2e743c946..fd915043bb9 100644
--- a/bin/csh/dol.c
+++ b/bin/csh/dol.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dol.c,v 1.13 2003/06/11 21:09:50 deraadt Exp $ */
+/* $OpenBSD: dol.c,v 1.14 2003/12/01 18:25:15 millert Exp $ */
/* $NetBSD: dol.c,v 1.8 1995/09/27 00:38:38 jtc Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dol.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: dol.c,v 1.13 2003/06/11 21:09:50 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: dol.c,v 1.14 2003/12/01 18:25:15 millert Exp $";
#endif
#endif /* not lint */
@@ -721,6 +721,7 @@ setDolp(Char *cp)
size_t len = Strlen(cp) + 1 - lhlen + rhlen;
np = (Char *) xmalloc(len * sizeof(Char));
+ *dp = 0;
(void) Strlcpy(np, cp, len);
(void) Strlcat(np, rhsub, len);
(void) Strlcat(np, dp + lhlen, len);