diff options
author | Thierry Deval <tdeval@cvs.openbsd.org> | 2003-04-16 23:11:53 +0000 |
---|---|---|
committer | Thierry Deval <tdeval@cvs.openbsd.org> | 2003-04-16 23:11:53 +0000 |
commit | 5e8530d18d562483353cc7c40db2db516e42ae99 (patch) | |
tree | 73786f63509f15358123d0b1b34e7a9b5194a0fa /bin/ksh/var.c | |
parent | fabf32e0c7ec1d169c392dd43d1c252d6d6cec17 (diff) |
string cleaning. ok tedu@
Diffstat (limited to 'bin/ksh/var.c')
-rw-r--r-- | bin/ksh/var.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/ksh/var.c b/bin/ksh/var.c index 98faa2cacc4..b6ee7ebf009 100644 --- a/bin/ksh/var.c +++ b/bin/ksh/var.c @@ -1,4 +1,4 @@ -/* $OpenBSD: var.c,v 1.13 2003/03/13 09:03:07 deraadt Exp $ */ +/* $OpenBSD: var.c,v 1.14 2003/04/16 23:11:52 tdeval Exp $ */ #include "sh.h" #include "ksh_time.h" @@ -1132,6 +1132,7 @@ arraysearch(vp, val) int val; { struct tbl *prev, *curr, *new; + size_t namelen = strlen(vp->name) + 1; vp->flag |= ARRAY|DEFINED; @@ -1152,9 +1153,9 @@ arraysearch(vp, val) else new = curr; } else - new = (struct tbl *)alloc(sizeof(struct tbl)+strlen(vp->name)+1, + new = (struct tbl *)alloc(sizeof(struct tbl) + namelen, vp->areap); - strcpy(new->name, vp->name); + strlcpy(new->name, vp->name, namelen); new->flag = vp->flag & ~(ALLOC|DEFINED|ISSET|SPECIAL); new->type = vp->type; new->areap = vp->areap; |