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;
 }
-- 
2.43.0
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to