]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
X25: Check that record is all ASCII digits
authorMark Andrews <marka@isc.org>
Thu, 13 Aug 2020 04:13:49 +0000 (14:13 +1000)
committerMark Andrews <marka@isc.org>
Thu, 13 Aug 2020 14:27:24 +0000 (00:27 +1000)
(cherry picked from commit 7e4968974681e63ac84d6309f66a30aa05d7618f)

lib/dns/rdata/generic/x25_19.c

index c1bc19b972cbf895f1d7996d67a8422578048377..6b48d4e06eb8f6fd1f06926f5293a2bf185d0ea7 100644 (file)
@@ -56,6 +56,7 @@ totext_x25(ARGS_TOTEXT) {
 static inline isc_result_t
 fromwire_x25(ARGS_FROMWIRE) {
        isc_region_t sr;
+       unsigned int i;
 
        REQUIRE(type == dns_rdatatype_x25);
 
@@ -65,8 +66,14 @@ fromwire_x25(ARGS_FROMWIRE) {
        UNUSED(options);
 
        isc_buffer_activeregion(source, &sr);
-       if (sr.length < 5)
+       if (sr.length < 5 || sr.base[0] != (sr.length - 1)) {
                return (DNS_R_FORMERR);
+       }
+       for (i = 1; i < sr.length; i++) {
+               if (sr.base[i] < 0x30 || sr.base[i] > 0x39) {
+                       return (DNS_R_FORMERR);
+               }
+       }
        return (txt_fromwire(source, target));
 }