2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 06:55:30 +00:00

X25: Check that record is all ASCII digits

This commit is contained in:
Mark Andrews
2020-08-13 14:13:49 +10:00
parent 9d446142d8
commit 7e49689746

View File

@@ -59,6 +59,7 @@ totext_x25(ARGS_TOTEXT) {
static inline isc_result_t static inline isc_result_t
fromwire_x25(ARGS_FROMWIRE) { fromwire_x25(ARGS_FROMWIRE) {
isc_region_t sr; isc_region_t sr;
unsigned int i;
REQUIRE(type == dns_rdatatype_x25); REQUIRE(type == dns_rdatatype_x25);
@@ -68,9 +69,14 @@ fromwire_x25(ARGS_FROMWIRE) {
UNUSED(options); UNUSED(options);
isc_buffer_activeregion(source, &sr); isc_buffer_activeregion(source, &sr);
if (sr.length < 5) { if (sr.length < 5 || sr.base[0] != (sr.length - 1)) {
return (DNS_R_FORMERR); 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)); return (txt_fromwire(source, target));
} }