summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2012-01-14 21:54:12 +0000
committerjilles <jilles@FreeBSD.org>2012-01-14 21:54:12 +0000
commit51c9a6e5fa70888f2cc5432a3b02f9fbfabf1655 (patch)
treea6f4ff30250184c9804eb55b59e4fdac3ef0d986 /bin/sh
parentc578dd940cf46033db16e2a6545bdf221612b85b (diff)
downloadFreeBSD-src-51c9a6e5fa70888f2cc5432a3b02f9fbfabf1655.zip
FreeBSD-src-51c9a6e5fa70888f2cc5432a3b02f9fbfabf1655.tar.gz
sh: Fix out of bounds array access when trap is used with an invalid signal.
MFC after: 1 week
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/trap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/sh/trap.c b/bin/sh/trap.c
index 2b6d8a5..a6f929d 100644
--- a/bin/sh/trap.c
+++ b/bin/sh/trap.c
@@ -191,10 +191,11 @@ trapcmd(int argc, char **argv)
argv++;
}
}
- while (*argv) {
+ for (; *argv; argv++) {
if ((signo = sigstring_to_signum(*argv)) == -1) {
warning("bad signal %s", *argv);
errors = 1;
+ continue;
}
INTOFF;
if (action)
@@ -205,7 +206,6 @@ trapcmd(int argc, char **argv)
if (signo != 0)
setsignal(signo);
INTON;
- argv++;
}
return errors;
}
OpenPOWER on IntegriCloud