summaryrefslogtreecommitdiffstats
path: root/sys/kern/imgact_shell.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2011-03-06 22:59:30 +0000
committerkib <kib@FreeBSD.org>2011-03-06 22:59:30 +0000
commitf3c6442b9399fa9d3cc1c7e47355f3b111aa429b (patch)
tree6ff814fe951bc8b87baf732d6e6e924b619fc79a /sys/kern/imgact_shell.c
parentf56b79fee1b3a270c7df9a507133ade99dc1ab2a (diff)
downloadFreeBSD-src-f3c6442b9399fa9d3cc1c7e47355f3b111aa429b.zip
FreeBSD-src-f3c6442b9399fa9d3cc1c7e47355f3b111aa429b.tar.gz
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
Diffstat (limited to 'sys/kern/imgact_shell.c')
-rw-r--r--sys/kern/imgact_shell.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/imgact_shell.c b/sys/kern/imgact_shell.c
index 0dc9299..d9884f5 100644
--- a/sys/kern/imgact_shell.c
+++ b/sys/kern/imgact_shell.c
@@ -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);
OpenPOWER on IntegriCloud