]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Make sure null atributes are never used
authorPetr Menšík <pemensik@redhat.com>
Fri, 4 Jan 2019 19:28:35 +0000 (20:28 +0100)
committerMark Andrews <marka@isc.org>
Wed, 16 Jan 2019 22:00:27 +0000 (09:00 +1100)
Add INSIST to pubattr fetching where null might occur in therory. Make
sure null is never dereferenced.

(cherry picked from commit fe9ef0d9f57a2e3f2902cf93d5f00aac3286dd99)

lib/dns/pkcs11ecdsa_link.c
lib/dns/pkcs11rsa_link.c

index 4a39cc4683fca69c2ca6fcef89120b6481bb0fc1..e2e09c0a9f782edea363f430a72cab39772a6784 100644 (file)
@@ -838,6 +838,7 @@ pkcs11ecdsa_fetch(dst_key_t *key, const char *engine, const char *label,
 
        attr->type = CKA_EC_PARAMS;
        pubattr = pk11_attribute_bytype(pubec, CKA_EC_PARAMS);
+       INSIST(pubattr != NULL);
        attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
        if (attr->pValue == NULL)
                DST_RET(ISC_R_NOMEMORY);
@@ -847,6 +848,7 @@ pkcs11ecdsa_fetch(dst_key_t *key, const char *engine, const char *label,
 
        attr->type = CKA_EC_POINT;
        pubattr = pk11_attribute_bytype(pubec, CKA_EC_POINT);
+       INSIST(pubattr != NULL);
        attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
        if (attr->pValue == NULL)
                DST_RET(ISC_R_NOMEMORY);
index 9fcc7ae10383179f8bb5c815e717e65513246355..ff6ce3a68f45e71f8a986ee02eb2da6bda40878f 100644 (file)
@@ -1749,6 +1749,7 @@ pkcs11rsa_fetch(dst_key_t *key, const char *engine, const char *label,
 
        attr->type = CKA_MODULUS;
        pubattr = pk11_attribute_bytype(pubrsa, CKA_MODULUS);
+       INSIST(pubattr != NULL);
        attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
        if (attr->pValue == NULL)
                DST_RET(ISC_R_NOMEMORY);
@@ -1758,6 +1759,7 @@ pkcs11rsa_fetch(dst_key_t *key, const char *engine, const char *label,
 
        attr->type = CKA_PUBLIC_EXPONENT;
        pubattr = pk11_attribute_bytype(pubrsa, CKA_PUBLIC_EXPONENT);
+       INSIST(pubattr != NULL);
        attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
        if (attr->pValue == NULL)
                DST_RET(ISC_R_NOMEMORY);