Re: [PATCH 1/2] modprobe: fix the NULL-termination of new_argv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Lucas,

Ping?


On Thu, Feb 10, 2022 at 11:14 AM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
>
> 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@xxxxxxxxxx>
> ---
>
>  tools/modprobe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/modprobe.c b/tools/modprobe.c
> index 9387537..b6b2947 100644
> --- a/tools/modprobe.c
> +++ b/tools/modprobe.c
> @@ -743,7 +743,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;
> --
> 2.32.0
>


-- 
Best Regards
Masahiro Yamada



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux