From: Mark Andrews Date: Thu, 13 Aug 2020 04:13:49 +0000 (+1000) Subject: X25: Check that record is all ASCII digits X-Git-Tag: v9.17.5~50^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e4968974681e63ac84d6309f66a30aa05d7618f;p=thirdparty%2Fbind9.git X25: Check that record is all ASCII digits --- diff --git a/lib/dns/rdata/generic/x25_19.c b/lib/dns/rdata/generic/x25_19.c index 4c536214786..93f99c8dc65 100644 --- a/lib/dns/rdata/generic/x25_19.c +++ b/lib/dns/rdata/generic/x25_19.c @@ -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)); }