]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix Coverity 1487923 Out-of-bounds read (wrong use of sizeof)
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 14 Apr 2022 05:43:36 +0000 (07:43 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 14 Apr 2022 05:43:36 +0000 (07:43 +0200)
pdns/syncres.cc

index b7439ee4c0e022f59c91ff5c3035689d736ac94b..b13f99e2c1858c5da423d7c77385646684a0cf36 100644 (file)
@@ -302,7 +302,7 @@ struct DoTStatus
   {
     const std::string n[] = { "Unknown", "Busy", "Bad", "Good"};
     unsigned int v = static_cast<unsigned int>(d_status);
-    return v >= sizeof(n) ? "?" : n[v];
+    return v > Status::Good ? "?" : n[v];
   }
 };