]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Minimal backport of #9497 to rec-4.2.x 9508/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 22 Sep 2020 11:21:39 +0000 (13:21 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 25 Sep 2020 07:01:51 +0000 (09:01 +0200)
pdns/dnsparser.cc

index f89ff3f67a003b77c016000620c4aab5b4bcb9fb..dbbbaf6ac5ee30c856574e0d335bc701e8b7f9d9 100644 (file)
@@ -50,7 +50,9 @@ public:
     out.reserve(total+1);
     for(unsigned int n=0; n < total; ++n) {
       int c;
-      sscanf(relevant.c_str()+2*n, "%02x", &c);
+      if (sscanf(&relevant.at(2*n), "%02x", &c) != 1) {
+        throw MOADNSException("unable to read data at position " + std::to_string(2 * n) + " from unknown record of size " + std::to_string(relevant.size()));
+      }
       out.append(1, (char)c);
     }