[PATCH] xxd: avoid use of uninitialised variable
Ron Yorston
rmy at pobox.com
Wed Sep 28 10:48:49 UTC 2022
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 at 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
More information about the busybox
mailing list