mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-04 23:50:27 +00:00
sh: Avoid out-of-bounds access in setoptionbyindex() for 'set -o nolog'.
Reported by: hrs
This commit is contained in:
parent
2472c543df
commit
c94a041f43
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=296577
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue