svn commit: r296577 - head/bin/sh
Jilles Tjoelker
jilles at FreeBSD.org
Wed Mar 9 21:00:58 UTC 2016
Author: jilles
Date: Wed Mar 9 21:00:57 2016
New Revision: 296577
URL: https://svnweb.freebsd.org/changeset/base/296577
Log:
sh: Avoid out-of-bounds access in setoptionbyindex() for 'set -o nolog'.
Reported by: hrs
Modified:
head/bin/sh/options.c
Modified: head/bin/sh/options.c
==============================================================================
--- head/bin/sh/options.c Wed Mar 9 20:15:03 2016 (r296576)
+++ head/bin/sh/options.c Wed Mar 9 21:00:57 2016 (r296577)
@@ -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;
}
}
More information about the svn-src-all
mailing list