From 4a4a76951210d1eec38d3d542e4daacee571fc5b Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Wed, 7 Jun 2023 15:20:23 -0600 Subject: [PATCH] check on allocation of new node before dereferencing --- src/x509.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/x509.c b/src/x509.c index 9caf3a626..908448320 100644 --- a/src/x509.c +++ b/src/x509.c @@ -13965,7 +13965,9 @@ int wolfSSL_X509_REQ_add1_attr_by_NID(WOLFSSL_X509 *req, else { if (req->reqAttributes == NULL) { 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); }