diff options
author | jilles <jilles@FreeBSD.org> | 2016-03-09 21:00:57 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2016-03-09 21:00:57 +0000 |
commit | e1e2ce9e63ea25705cdb73843b819f7a6d6c5378 (patch) | |
tree | 3cc30c057bfd16e192eb4951d7259f2077363085 | |
parent | efc97b3f14e8aa7d2ac1f64cb4977d5ceafe5f98 (diff) | |
download | FreeBSD-src-e1e2ce9e63ea25705cdb73843b819f7a6d6c5378.zip FreeBSD-src-e1e2ce9e63ea25705cdb73843b819f7a6d6c5378.tar.gz |
sh: Avoid out-of-bounds access in setoptionbyindex() for 'set -o nolog'.
Reported by: hrs
-rw-r--r-- | bin/sh/options.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/sh/options.c b/bin/sh/options.c index 70a09c3..340d7e0 100644 --- a/bin/sh/options.c +++ b/bin/sh/options.c @@ -285,7 +285,7 @@ minus_o(char *name, int val) static void setoptionbyindex(int idx, int val) { - if (optletter[idx] == 'p' && !val && privileged) { + if (&optval[idx] == &privileged && !val && privileged) { if (setgid(getgid()) == -1) error("setgid"); if (setuid(getuid()) == -1) @@ -294,9 +294,9 @@ setoptionbyindex(int idx, int val) optval[idx] = val; if (val) { /* #%$ hack for ksh semantics */ - if (optletter[idx] == 'V') + if (&optval[idx] == &Vflag) Eflag = 0; - else if (optletter[idx] == 'E') + else if (&optval[idx] == &Eflag) Vflag = 0; } } |