[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH] xxd: avoid use of uninitialised variable
From:       Ron Yorston <rmy () pobox ! com>
Date:       2022-09-28 10:48:49
Message-ID: 63342691.N/1gXRsppAjCgVxD%rmy () pobox ! com
[Download RAW message or body]

If xxd is run with '-r' but no '-s' the value of opt_s passed to
reverse() is uninitialised.

function                                             old     new   delta
xxd_main                                            1494    1499      +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 5/0)                 Total: 5 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
---
 util-linux/hexdump_xxd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util-linux/hexdump_xxd.c b/util-linux/hexdump_xxd.c
index 6629407de..049ed4395 100644
--- a/util-linux/hexdump_xxd.c
+++ b/util-linux/hexdump_xxd.c
@@ -229,7 +229,7 @@ int xxd_main(int argc UNUSED_PARAM, char **argv)
 {
 	char buf[80];
 	dumper_t *dumper;
-	char *opt_l, *opt_s, *opt_o;
+	char *opt_l, *opt_s = NULL, *opt_o;
 	unsigned bytes = 2;
 	unsigned cols = 0;
 	unsigned opt;
-- 
2.37.3

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic