modprobe: fix the NULL-termination of new_argv

The number of new arguments is (i + argc - 1) as it is set to *p_argc
one line below.

The correct location of NULL termination is new_argv[i + argc - 1].

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
This commit is contained in:
Masahiro Yamada 2022-02-10 11:14:22 +09:00 committed by Lucas De Marchi
parent f50e2d6757
commit 757b359923
1 changed files with 1 additions and 1 deletions

View File

@ -744,7 +744,7 @@ static char **prepend_options_from_env(int *p_argc, char **orig_argv)
}
memcpy(new_argv + i, orig_argv + 1, sizeof(char *) * (argc - 1));
new_argv[i + argc] = NULL;
new_argv[i + argc - 1] = NULL;
*p_argc = i + argc - 1;
return new_argv;