fix(parse): bug where args aren't null terminated

This commit is contained in:
Ahurac 2024-11-08 11:50:55 +01:00
parent 5b18608b26
commit 9c41981502

View file

@ -19,6 +19,7 @@ void add_arg(struct Args *args, char *arg_ptr, unsigned int arg_length) {
char *arg = malloc(arg_length + 1); char *arg = malloc(arg_length + 1);
strncpy(arg, arg_ptr, arg_length); strncpy(arg, arg_ptr, arg_length);
arg[arg_length] = '\0';
args->argv[args->argc] = arg; args->argv[args->argc] = arg;
args->argc++; args->argc++;