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 <[email protected]>
Signed-off-by: Lucas De Marchi <[email protected]>
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 @@
}
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;