Make sure null atributes are never used
Add INSIST to pubattr fetching where null might occur in therory. Make sure null is never dereferenced.
This commit is contained in:
committed by
Mark Andrews
parent
3d5826b75b
commit
fe9ef0d9f5
@@ -837,6 +837,7 @@ pkcs11ecdsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
|
|
||||||
attr->type = CKA_EC_PARAMS;
|
attr->type = CKA_EC_PARAMS;
|
||||||
pubattr = pk11_attribute_bytype(pubec, CKA_EC_PARAMS);
|
pubattr = pk11_attribute_bytype(pubec, CKA_EC_PARAMS);
|
||||||
|
INSIST(pubattr != NULL);
|
||||||
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
if (attr->pValue == NULL)
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
DST_RET(ISC_R_NOMEMORY);
|
||||||
@@ -846,6 +847,7 @@ pkcs11ecdsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
|
|
||||||
attr->type = CKA_EC_POINT;
|
attr->type = CKA_EC_POINT;
|
||||||
pubattr = pk11_attribute_bytype(pubec, CKA_EC_POINT);
|
pubattr = pk11_attribute_bytype(pubec, CKA_EC_POINT);
|
||||||
|
INSIST(pubattr != NULL);
|
||||||
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
if (attr->pValue == NULL)
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
DST_RET(ISC_R_NOMEMORY);
|
||||||
|
|||||||
@@ -1673,6 +1673,7 @@ pkcs11rsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
|
|
||||||
attr->type = CKA_MODULUS;
|
attr->type = CKA_MODULUS;
|
||||||
pubattr = pk11_attribute_bytype(pubrsa, CKA_MODULUS);
|
pubattr = pk11_attribute_bytype(pubrsa, CKA_MODULUS);
|
||||||
|
INSIST(pubattr != NULL);
|
||||||
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
if (attr->pValue == NULL)
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
DST_RET(ISC_R_NOMEMORY);
|
||||||
@@ -1682,6 +1683,7 @@ pkcs11rsa_fetch(dst_key_t *key, const char *engine, const char *label,
|
|||||||
|
|
||||||
attr->type = CKA_PUBLIC_EXPONENT;
|
attr->type = CKA_PUBLIC_EXPONENT;
|
||||||
pubattr = pk11_attribute_bytype(pubrsa, CKA_PUBLIC_EXPONENT);
|
pubattr = pk11_attribute_bytype(pubrsa, CKA_PUBLIC_EXPONENT);
|
||||||
|
INSIST(pubattr != NULL);
|
||||||
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
attr->pValue = isc_mem_get(key->mctx, pubattr->ulValueLen);
|
||||||
if (attr->pValue == NULL)
|
if (attr->pValue == NULL)
|
||||||
DST_RET(ISC_R_NOMEMORY);
|
DST_RET(ISC_R_NOMEMORY);
|
||||||
|
|||||||
Reference in New Issue
Block a user