svn commit: r230439 - stable/9/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Sat Jan 21 21:54:32 UTC 2012


Author: jilles
Date: Sat Jan 21 21:54:31 2012
New Revision: 230439
URL: http://svn.freebsd.org/changeset/base/230439

Log:
  MFC r230117: sh: Fix out of bounds array access when trap is used with an
  invalid signal.

Modified:
  stable/9/bin/sh/trap.c
Directory Properties:
  stable/9/bin/sh/   (props changed)

Modified: stable/9/bin/sh/trap.c
==============================================================================
--- stable/9/bin/sh/trap.c	Sat Jan 21 21:12:53 2012	(r230438)
+++ stable/9/bin/sh/trap.c	Sat Jan 21 21:54:31 2012	(r230439)
@@ -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;
 }


More information about the svn-src-all mailing list