From 853d7d5c53fb0ea1a1528d1a5f0984295e759c0c 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..42985198d 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,