From: Remi Gacogne Date: Tue, 3 May 2022 10:15:57 +0000 (+0200) Subject: dnsdist: Hopefully prevent a CodeQL warning in the netlink code X-Git-Tag: auth-4.8.0-alpha0~93^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f161f5ff5585a0c483faaf9fa16fd579f11d64d5;p=thirdparty%2Fpdns.git dnsdist: Hopefully prevent a CodeQL warning in the netlink code --- diff --git a/pdns/misc.cc b/pdns/misc.cc index d0837585b9..9af6543b42 100644 --- a/pdns/misc.cc +++ b/pdns/misc.cc @@ -1204,7 +1204,7 @@ int getMACAddress(const ComboAddress& ca, char* dest, size_t destLen) } auto nd = reinterpret_cast(NLMSG_DATA(nlmsgheader)); - auto rtatp = reinterpret_cast(((char*)(nd)) + NLMSG_ALIGN(sizeof(struct ndmsg))); + auto rtatp = reinterpret_cast(reinterpret_cast(nd) + NLMSG_ALIGN(sizeof(struct ndmsg))); int rtattrlen = nlmsgheader->nlmsg_len - NLMSG_LENGTH(sizeof(struct ndmsg)); if (nd->ndm_family != ca.sin4.sin_family) { @@ -1231,7 +1231,7 @@ int getMACAddress(const ComboAddress& ca, char* dest, size_t destLen) if ((rtatp->rta_len - sizeof(struct rtattr)) != destLen) { return EINVAL; } - memcpy(dest, (rtatp+1), destLen); + memcpy(dest, reinterpret_cast(rtatp) + sizeof(struct rtattr), destLen); foundMAC = true; done = true; break;