aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-04-27 08:22:01 -0400
committerIan Moffett <ian@osmora.org>2024-04-27 08:22:01 -0400
commita65592778b5cb6adde3ab53ebe758c4d875a0d79 (patch)
tree64e8dbc6f29b8351fbabf9e25386c7a5907362a2 /sys/kern/kern_exec.c
parent1b06e8c0547de9e43f59bb11179216d25655305f (diff)
kernel: kern_exec: Fix argp resize logic
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index bcd7a2e..0386ffd 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -61,6 +61,7 @@ exec_get_args(char **argv, struct exec_args *res)
{
const size_t ARG_LEN = sizeof(char) * ARG_MAX;
char *argp = NULL;
+ void *tmp;
struct proc *td;
size_t argp_len = 0;
@@ -89,11 +90,12 @@ exec_get_args(char **argv, struct exec_args *res)
copyin((uintptr_t)++argv, &argp, sizeof(char *));
/* Try to resize the argp buffer */
- res->argp = dynrealloc(res->argp, ARG_LEN * (argp_len + 1));
- if (res->argp == NULL) {
+ tmp = dynrealloc(res->argp, ARG_LEN * (argp_len + 1));
+ if (tmp == NULL) {
dynfree(res->argp);
return -ENOMEM;
}
+ res->argp = tmp;
}
return 0;