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);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to