diff options
author | zhuk <zhuk@openbsd.org> | 2021-03-05 15:22:03 +0000 |
---|---|---|
committer | zhuk <zhuk@openbsd.org> | 2021-03-05 15:22:03 +0000 |
commit | 0f7e252d5c47dee06d76308af9326d47daf9f02c (patch) | |
tree | e16cf8e8158e238231e6b978d1cd6c7b3e2fdb24 /bin | |
parent | ansi (diff) | |
download | wireguard-openbsd-0f7e252d5c47dee06d76308af9326d47daf9f02c.tar.xz wireguard-openbsd-0f7e252d5c47dee06d76308af9326d47daf9f02c.zip |
Fix old ksh bug: wrong variable being looked up when value is provided.
This results, e.g., in allowing the first item of a read-only array to
be overwritten, as found by Jordan Geoghegan.
okay tb@
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ksh/var.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/ksh/var.c b/bin/ksh/var.c index 6cfe75e456c..9dbba073166 100644 --- a/bin/ksh/var.c +++ b/bin/ksh/var.c @@ -1,4 +1,4 @@ -/* $OpenBSD: var.c,v 1.71 2020/02/21 18:21:23 tb Exp $ */ +/* $OpenBSD: var.c,v 1.72 2021/03/05 15:22:03 zhuk Exp $ */ #include <sys/stat.h> #include <sys/time.h> @@ -644,7 +644,7 @@ typeset(const char *var, int set, int clr, int field, int base) global(tvar); set &= ~(LOCAL|LOCAL_COPY); - vpbase = (vp->flag & ARRAY) ? global(arrayname(var)) : vp; + vpbase = (vp->flag & ARRAY) ? global(arrayname(tvar)) : vp; /* only allow export flag to be set. at&t ksh allows any attribute to * be changed, which means it can be truncated or modified |