]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
fix labelcount for root 1319/head
authorKees Monshouwer <mind04@monshouwer.org>
Sun, 16 Feb 2014 19:17:59 +0000 (20:17 +0100)
committermind04 <mind04@monshouwer.org>
Sun, 16 Feb 2014 19:17:59 +0000 (20:17 +0100)
pdns/dnssecinfra.cc

index 85fb5ada9820bad38fb3627363ebd12cec142e4a..a8a77fd8358f7520c50363de30b6b1680b5d4b1c 100644 (file)
@@ -305,14 +305,17 @@ DNSKEYRecordContent makeDNSKEYFromDNSCryptoKeyEngine(const DNSCryptoKeyEngine* p
 
 int countLabels(const std::string& signQName)
 {
-  int count =1;
-  for(string::const_iterator pos = signQName.begin(); pos != signQName.end() ; ++pos) 
-    if(*pos == '.' && pos+1 != signQName.end()) 
-      count++;
-
-  if(boost::starts_with(signQName, "*."))
-    count--;
-  return count;
+  if(!signQName.empty()) {
+    int count=1;
+    for(string::const_iterator pos = signQName.begin(); pos != signQName.end() ; ++pos)
+      if(*pos == '.' && pos+1 != signQName.end())
+        count++;
+
+    if(boost::starts_with(signQName, "*."))
+      count--;
+    return count;
+  }
+  return 0;
 }
 
 uint32_t getStartOfWeek()