Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Mar 2011 22:59:30 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r219352 - head/sys/kern
Message-ID:  <201103062259.p26MxUiw012103@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sun Mar  6 22:59:30 2011
New Revision: 219352
URL: http://svn.freebsd.org/changeset/base/219352

Log:
  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.
  
  Submitted by:	Devon H. O'Dell <devon.odell gmail com>
  PR:	kern/155321
  MFC after:	1 week

Modified:
  head/sys/kern/imgact_shell.c

Modified: head/sys/kern/imgact_shell.c
==============================================================================
--- head/sys/kern/imgact_shell.c	Sun Mar  6 22:56:14 2011	(r219351)
+++ head/sys/kern/imgact_shell.c	Sun Mar  6 22:59:30 2011	(r219352)
@@ -195,7 +195,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?201103062259.p26MxUiw012103>