diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2022-02-10 11:14:22 +0900 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2022-04-04 08:14:40 -0700 |
commit | 757b3599236c0fee9e2bb0770eb6b7c84a271276 (patch) | |
tree | 63247c38ce4b49861296f58b4d3fdaaba1791230 | |
parent | f50e2d67575ac5f256fb853ca9d29aeac92d9a57 (diff) | |
download | kmod-757b3599236c0fee9e2bb0770eb6b7c84a271276.tar.gz kmod-757b3599236c0fee9e2bb0770eb6b7c84a271276.tar.bz2 kmod-757b3599236c0fee9e2bb0770eb6b7c84a271276.zip |
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>
-rw-r--r-- | tools/modprobe.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/modprobe.c b/tools/modprobe.c index eed951f..48b1c8c 100644 --- a/tools/modprobe.c +++ b/tools/modprobe.c @@ -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; |