]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] change 3630 incomplete--needed to check fromtext too
authorEvan Hunt <each@isc.org>
Thu, 15 Aug 2013 00:23:41 +0000 (17:23 -0700)
committerEvan Hunt <each@isc.org>
Thu, 15 Aug 2013 00:23:41 +0000 (17:23 -0700)
lib/dns/rdata/generic/dnskey_48.c
lib/dns/rdata/generic/key_25.c
lib/dns/rdata/generic/keydata_65533.c

index 6ae8dfbbdb86c6256f0f7d9c32ef757f79d97b35..53325b3635e3c65719e7cb28b8ffe482ddf6c500 100644 (file)
@@ -32,6 +32,7 @@
 
 static inline isc_result_t
 fromtext_dnskey(ARGS_FROMTEXT) {
+       isc_result_t result;
        isc_token_t token;
        dns_secalg_t alg;
        dns_secproto_t proto;
@@ -67,7 +68,15 @@ fromtext_dnskey(ARGS_FROMTEXT) {
        if ((flags & 0xc000) == 0xc000)
                return (ISC_R_SUCCESS);
 
-       return (isc_base64_tobuffer(lexer, target, -1));
+       result = isc_base64_tobuffer(lexer, target, -1);
+       if (result != ISC_R_SUCCESS)
+               return (result);
+
+       /* Ensure there's at least enough data to compute a key ID for MD5 */
+       if (alg == DST_ALG_RSAMD5 && isc_buffer_usedlength(target) < 7)
+               return (ISC_R_UNEXPECTEDEND);
+
+       return (ISC_R_SUCCESS);
 }
 
 static inline isc_result_t
index b10bbd528dbd70c05bad21a8fcd9e5df41ebfe46..f55401e1b8acd6bc2c48b50de7e392fd7b7f53de 100644 (file)
@@ -32,6 +32,7 @@
 
 static inline isc_result_t
 fromtext_key(ARGS_FROMTEXT) {
+       isc_result_t result;
        isc_token_t token;
        dns_secalg_t alg;
        dns_secproto_t proto;
@@ -67,7 +68,15 @@ fromtext_key(ARGS_FROMTEXT) {
        if ((flags & 0xc000) == 0xc000)
                return (ISC_R_SUCCESS);
 
-       return (isc_base64_tobuffer(lexer, target, -1));
+       result = isc_base64_tobuffer(lexer, target, -1);
+       if (result != ISC_R_SUCCESS)
+               return (result);
+
+       /* Ensure there's at least enough data to compute a key ID for MD5 */
+       if (alg == DST_ALG_RSAMD5 && isc_buffer_usedlength(target) < 7)
+               return (ISC_R_UNEXPECTEDEND);
+
+       return (ISC_R_SUCCESS);
 }
 
 static inline isc_result_t
index a3ed8603fefc9645e5a6b05330e20c9c86b4f169..03ad1ed7382f546aafd9bcf7e567f1b45d5af977 100644 (file)
@@ -25,6 +25,7 @@
 
 static inline isc_result_t
 fromtext_keydata(ARGS_FROMTEXT) {
+       isc_result_t result;
        isc_token_t token;
        dns_secalg_t alg;
        dns_secproto_t proto;
@@ -79,7 +80,15 @@ fromtext_keydata(ARGS_FROMTEXT) {
        if ((flags & 0xc000) == 0xc000)
                return (ISC_R_SUCCESS);
 
-       return (isc_base64_tobuffer(lexer, target, -1));
+       result = isc_base64_tobuffer(lexer, target, -1);
+       if (result != ISC_R_SUCCESS)
+               return (result);
+
+       /* Ensure there's at least enough data to compute a key ID for MD5 */
+       if (alg == DST_ALG_RSAMD5 && isc_buffer_usedlength(target) < 19)
+               return (ISC_R_UNEXPECTEDEND);
+
+       return (ISC_R_SUCCESS);
 }
 
 static inline isc_result_t