Hi,

El vie, 18 abr 2025 a las 12:22, <[email protected]> escribió:
>
> From: Maks Mishin <[email protected]>
>
> The `argv[2]` is checked for NULL in applets_tables.c:214
> and then passed to the rename function in applets_tables.c:241
> without checking for NULL.
>
> Undefined behavior may occur when calling the rename function with this 
> argument.
>
> Signed-off-by: Maks Mishin <[email protected]>
> ---
>  applets/applet_tables.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/applets/applet_tables.c b/applets/applet_tables.c
> index 66ef7e4ac..ccde59921 100644
> --- a/applets/applet_tables.c
> +++ b/applets/applet_tables.c
> @@ -238,7 +238,7 @@ int main(int argc, char **argv)
>                 return 1;
>         if (rename(tmp1, argv[1]))
>                 return 1;
> -       if (rename(tmp2, argv[2]))
> +       if (argv[2] && rename(tmp2, argv[2]))
>                 return 1;
>         return 0;
>  }
> --

We always want both files created at the same time, so I would better
ensure both arguments are passed to applet_tables, instead of
erroring-out after all work is done.

Cheers,

Xabier Oneca_,,_
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to