]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix a few warnings found by compiler on MacOS, where char is unsigned 11719/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 23 Jun 2022 14:23:05 +0000 (16:23 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 23 Jun 2022 14:23:05 +0000 (16:23 +0200)
pdns/dnslabeltext.rl
pdns/dnsname.cc

index 87a5799672f6eb1107deb2113e4316af98fa1f59..27f435094dc29b986b14615343cda5ac3736001d 100644 (file)
@@ -108,11 +108,11 @@ DNSName::string_t segmentDNSNameRaw(const char* realinput, size_t inputlen)
         const char* eof = pe;
         int cs;
         char val = 0;
-        char labellen=0;
+        unsigned char labellen=0;
         unsigned int lenpos=0;
         %%{
                 action labelEnd { 
-                        if (labellen < 0 || labellen > 63) {
+                        if (labellen > 63) {
                           throw runtime_error("Unable to parse DNS name '"+string(realinput)+"': invalid label length "+std::to_string(labellen));
                         }
                         ret[lenpos]=labellen;
index c2b48e9fd7731aabd252b5ab5b4119f30fa75c0b..22e2cf9f5774ac2cebba0bc49210f0f8cc574de7 100644 (file)
@@ -255,8 +255,8 @@ bool DNSName::isPartOf(const DNSName& parent) const
       }
       return true;
     }
-    if (*us < 0) {
-      throw std::out_of_range("negative label length in dnsname");
+    if (static_cast<uint8_t>(*us) > 63) {
+      throw std::out_of_range("illegal label length in dnsname");
     }
   }
   return false;