aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/imgact_shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/imgact_shell.c')
-rw-r--r--sys/kern/imgact_shell.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/sys/kern/imgact_shell.c b/sys/kern/imgact_shell.c
index 487d7b3ea05f..d5287a4e95d1 100644
--- a/sys/kern/imgact_shell.c
+++ b/sys/kern/imgact_shell.c
@@ -196,20 +196,13 @@ exec_shell_imgact(struct image_params *imgp)
length = (imgp->args->argc == 0) ? 0 :
strlen(imgp->args->begin_argv) + 1; /* bytes to delete */
- if (offset > imgp->args->stringspace + length) {
+ error = exec_args_adjust_args(imgp->args, length, offset);
+ if (error != 0) {
if (sname != NULL)
sbuf_delete(sname);
- return (E2BIG);
+ return (error);
}
- bcopy(imgp->args->begin_argv + length, imgp->args->begin_argv + offset,
- imgp->args->endp - (imgp->args->begin_argv + length));
-
- offset -= length; /* calculate actual adjustment */
- imgp->args->begin_envv += offset;
- imgp->args->endp += offset;
- imgp->args->stringspace -= offset;
-
/*
* If there was no arg[0] when we started, then the interpreter_name
* is adding an argument (instead of replacing the arg[0] we started