From 7f09b066155f170c0e868a36bbedeae95e197e08 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Sat, 30 Oct 2021 08:28:34 +1100 Subject: [PATCH] Silence cppcheck possible NULL pointer dereference Use isc_region_t instead of isc_textregion_t as ccpcheck marked tr.base as not initalised. --- lib/dns/rdata.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c index a5e7831b06a..fa51b5af7ff 100644 --- a/lib/dns/rdata.c +++ b/lib/dns/rdata.c @@ -1890,9 +1890,9 @@ inet_totext(int af, uint32_t flags, isc_region_t *src, isc_buffer_t *target) { * parsing, so append 0 in that case. */ if (af == AF_INET6 && (flags & DNS_STYLEFLAG_YAML) != 0) { - isc_textregion_t tr; - isc_buffer_usedregion(target, (isc_region_t *)&tr); - if (tr.base[tr.length - 1] == ':') { + isc_region_t r; + isc_buffer_usedregion(target, &r); + if (r.length > 0U && r.base[r.length - 1] == ':') { if (isc_buffer_availablelength(target) == 0) { return (ISC_R_NOSPACE); } -- 2.47.3