From 58efb2f740e920fcc4bef654b0492955c1dbe9c5 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 19 Jan 2024 12:37:10 +1100 Subject: [PATCH] Address infinite loop when processing $GENERATE In nibble mode if the value to be converted was negative the parser would loop forever. Process the value as an unsigned int instead of as an int to prevent sign extension when shifting. This was found by Eric Sesterhenn from X41. (cherry picked from commit 371824f0789d6e491216f266bf62955a73b49858) --- lib/dns/master.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dns/master.c b/lib/dns/master.c index c785022721..eab1d00364 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -626,7 +626,8 @@ static const char *hex = "0123456789abcdef0123456789ABCDEF"; * counting the terminating NUL. */ static unsigned int -nibbles(char *numbuf, size_t length, unsigned int width, char mode, int value) { +nibbles(char *numbuf, size_t length, unsigned int width, char mode, + unsigned int value) { unsigned int count = 0; /*