[PATCH] coreutils: fix potential buffer overflow

ant.v.moryakov at gmail.com ant.v.moryakov at gmail.com
Fri Apr 18 10:21:35 UTC 2025


From: Maks Mishin <maks.mishinFZ at gmail.com>

Signed-off-by: Maks Mishin <maks.mishinFZ at gmail.com>
---
 coreutils/od_bloaty.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index 5b5e56a..d5b8999 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -1233,8 +1233,10 @@ int od_main(int argc UNUSED_PARAM, char **argv)
 				"'%c' (must be [doxn])", str_A[0]);
 		pos = p - doxn;
 		if (pos == 3) G.format_address = format_address_none;
-		address_base_char = doxn_address_base_char[pos];
-		address_pad_len_char = doxn_address_pad_len_char[pos];
+		if (pos < 3) {
+			address_base_char = doxn_address_base_char[pos];
+			address_pad_len_char = doxn_address_pad_len_char[pos];
+		}
 	}
 	if (opt & OPT_N) {
 		max_bytes_to_format = xstrtooff_sfx(str_N, 0, bkm_suffixes);
-- 
2.43.0


More information about the busybox mailing list