]> 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 13:06:55 +0000 (23:06 +1000)
lib/dns/rdata/generic/x25_19.c

index 4c536214786ce4e3d5f9ce7af5b46c359d72cb12..93f99c8dc657cfaf30909bb3468722107995c0a3 100644 (file)
@@ -59,6 +59,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);
 
@@ -68,9 +69,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));
 }