From d63bb23f4d3d9de90a9f3d4826a7955648718bbe Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Tue, 23 Jul 2024 09:29:51 +0200 Subject: [PATCH] dns/rr: fix dns_rr_print underflow found by coverity --- src/dns/rr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dns/rr.c b/src/dns/rr.c index 513b30489..35fc1535c 100644 --- a/src/dns/rr.c +++ b/src/dns/rr.c @@ -615,8 +615,10 @@ int dns_rr_print(struct re_printf *pf, const struct dnsrr *rr) n = (w > l) ? w - l : 0; err = re_hprintf(pf, "%s.", rr->name); - while (n--) + while (n) { err |= pf->vph(" ", 1, pf->arg); + --n; + } err |= re_hprintf(pf, " %10lld %-4s %-7s ", rr->ttl,