]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
IPSECKEY: require non-zero length public keys
authorMark Andrews <marka@isc.org>
Thu, 13 Aug 2020 03:08:17 +0000 (13:08 +1000)
committerMark Andrews <marka@isc.org>
Thu, 13 Aug 2020 13:06:55 +0000 (23:06 +1000)
lib/dns/rdata/generic/ipseckey_45.c

index 48cf39b6e89d056a8ee8542271f081cbb7ac5c35..db5f29b19cea3f1e3967a78010bcf378717b8b25 100644 (file)
@@ -230,18 +230,21 @@ fromwire_ipseckey(ARGS_FROMWIRE) {
 
        switch (region.base[1]) {
        case 0:
+               if (region.length < 4) {
+                       return (ISC_R_UNEXPECTEDEND);
+               }
                isc_buffer_forward(source, region.length);
                return (mem_tobuffer(target, region.base, region.length));
 
        case 1:
-               if (region.length < 7) {
+               if (region.length < 8) {
                        return (ISC_R_UNEXPECTEDEND);
                }
                isc_buffer_forward(source, region.length);
                return (mem_tobuffer(target, region.base, region.length));
 
        case 2:
-               if (region.length < 19) {
+               if (region.length < 20) {
                        return (ISC_R_UNEXPECTEDEND);
                }
                isc_buffer_forward(source, region.length);
@@ -253,6 +256,9 @@ fromwire_ipseckey(ARGS_FROMWIRE) {
                RETERR(dns_name_fromwire(&name, source, dctx, options, target));
                isc_buffer_activeregion(source, &region);
                isc_buffer_forward(source, region.length);
+               if (region.length < 1) {
+                       return (ISC_R_UNEXPECTEDEND);
+               }
                return (mem_tobuffer(target, region.base, region.length));
 
        default: