diff options
author | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2002-02-27 19:37:10 +0000 |
---|---|---|
committer | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2002-02-27 19:37:10 +0000 |
commit | 797e18658d422e8b62d08dfd200ec9bf0a06acc4 (patch) | |
tree | 3384f24221477d43a6265a24a835a83c97c22ab7 /bin | |
parent | fd65dce822c9526f698c5f08ae844eaa21ec03a1 (diff) |
Fix three off-by-one errors. ok espie@, millert@, miod@
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ksh/tree.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/ksh/tree.c b/bin/ksh/tree.c index bf8e879ec17..e412790b7f7 100644 --- a/bin/ksh/tree.c +++ b/bin/ksh/tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tree.c,v 1.9 1999/07/14 13:37:24 millert Exp $ */ +/* $OpenBSD: tree.c,v 1.10 2002/02/27 19:37:09 dhartmei Exp $ */ /* * command tree climbing @@ -508,7 +508,7 @@ tcopy(t, ap) for (tw = t->vars; *tw++ != NULL; ) ; rw = r->vars = (char **) - alloc((int)(tw - t->vars) * sizeof(*tw), ap); + alloc((tw - t->vars + 1) * sizeof(*tw), ap); for (tw = t->vars; *tw != NULL; ) *rw++ = wdcopy(*tw++, ap); *rw = NULL; @@ -520,7 +520,7 @@ tcopy(t, ap) for (tw = t->args; *tw++ != NULL; ) ; rw = r->args = (char **) - alloc((int)(tw - t->args) * sizeof(*tw), ap); + alloc((tw - t->args + 1) * sizeof(*tw), ap); for (tw = t->args; *tw != NULL; ) *rw++ = wdcopy(*tw++, ap); *rw = NULL; @@ -681,7 +681,7 @@ iocopy(iow, ap) for (ior = iow; *ior++ != NULL; ) ; - ior = (struct ioword **) alloc((int)(ior - iow) * sizeof(*ior), ap); + ior = (struct ioword **) alloc((ior - iow + 1) * sizeof(*ior), ap); for (i = 0; iow[i] != NULL; i++) { register struct ioword *p, *q; |