check on allocation of new node before dereferencing

This commit is contained in:
JacobBarthelmeh
2023-06-07 15:20:23 -06:00
parent 84979900a7
commit 4a4a769512

View File

@ -13965,7 +13965,9 @@ int wolfSSL_X509_REQ_add1_attr_by_NID(WOLFSSL_X509 *req,
else { else {
if (req->reqAttributes == NULL) { if (req->reqAttributes == NULL) {
req->reqAttributes = wolfSSL_sk_new_node(req->heap); req->reqAttributes = wolfSSL_sk_new_node(req->heap);
req->reqAttributes->type = STACK_TYPE_X509_REQ_ATTR; if (req->reqAttributes != NULL) {
req->reqAttributes->type = STACK_TYPE_X509_REQ_ATTR;
}
} }
ret = wolfSSL_sk_push(req->reqAttributes, attr); ret = wolfSSL_sk_push(req->reqAttributes, attr);
} }