From dcc5161240fe3b5c993297880432e150ff124f3b Mon Sep 17 00:00:00 2001 From: WanBingjiang Date: Mon, 2 Feb 2026 14:55:11 +0800 Subject: [PATCH] hexdump: fixes Heap-buffer-overflow in rewrite_rules --- text-utils/hexdump-parse.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/text-utils/hexdump-parse.c b/text-utils/hexdump-parse.c index efc39c3b3..9363b957d 100644 --- a/text-utils/hexdump-parse.c +++ b/text-utils/hexdump-parse.c @@ -358,14 +358,15 @@ isint: cs[3] = '\0'; FALLTHROUGH; case 'a': pr->flags = F_ADDRESS; - ++p2; - if (first_letter(p1 + 2, "dox")) { + if (p1[2] && first_letter(p1 + 2, "dox")) { + ++p2; cs[0] = 'l'; cs[1] = 'l'; cs[2] = p1[2]; cs[3] = '\0'; } else { - p1[3] = '\0'; + if (p1[2]) + p1[3] = '\0'; badconv(p1); } break; -- 2.47.3