Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Mar 2011 09:36:52 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r219594 - stable/8/sys/kern
Message-ID:  <201103130936.p2D9aqKI048594@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sun Mar 13 09:36:52 2011
New Revision: 219594
URL: http://svn.freebsd.org/changeset/base/219594

Log:
  MFC r219352:
  The execution of the shebang script requires putting interpreter path,
  possible option and script path in the place of argv[0] supplied to
  execve(2).  It is possible and valid for the substitution to be shorter
  then the argv[0].
  
  Avoid signed underflow in this case.
  
  PR:     kern/155321

Modified:
  stable/8/sys/kern/imgact_shell.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/kern/imgact_shell.c
==============================================================================
--- stable/8/sys/kern/imgact_shell.c	Sun Mar 13 08:59:46 2011	(r219593)
+++ stable/8/sys/kern/imgact_shell.c	Sun Mar 13 09:36:52 2011	(r219594)
@@ -191,7 +191,7 @@ exec_shell_imgact(imgp)
 	length = (imgp->args->argc == 0) ? 0 :
 	    strlen(imgp->args->begin_argv) + 1;		/* bytes to delete */
 
-	if (offset - length > imgp->args->stringspace) {
+	if (offset > imgp->args->stringspace + length) {
 		if (sname != NULL)
 			sbuf_delete(sname);
 		return (E2BIG);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103130936.p2D9aqKI048594>