]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: don't increment in a potential macro argument 16051/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 28 Aug 2025 07:53:53 +0000 (09:53 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 28 Aug 2025 09:13:29 +0000 (11:13 +0200)
Fixes g++ 8: ../dnsdist-crypto.cc:291:16: warning: operation on 'count' may be undefined [-Wsequence-point]

Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
(cherry picked from commit 6a269e10520ffd5431830e8c1ee87e464d458663)

pdns/dnsdistdist/dnsdist-crypto.cc

index df4beebcb27b4ae5318ae0182cfbe77d152a198d..662a701ef812202bf8878087d929ecd009632355 100644 (file)
@@ -287,8 +287,8 @@ void Nonce::increment()
 {
   // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
   auto* ptr = reinterpret_cast<uint32_t*>(value.data());
-  uint32_t count = htonl(*ptr);
-  *ptr = ntohl(++count);
+  uint32_t count = htonl(*ptr) + 1;
+  *ptr = ntohl(count);
 }
 
 #else