allocate a new attributes entry in X509_REQ_add_extensions()
authorNils Larsch <nils@openssl.org>
Mon, 4 Dec 2006 19:11:57 +0000 (19:11 +0000)
committerNils Larsch <nils@openssl.org>
Mon, 4 Dec 2006 19:11:57 +0000 (19:11 +0000)
if it's NULL (in case of a malformed pkcs10 request)

PR: 1347
Submitted by: Remo Inverardi <invi@your.toilet.ch>

crypto/x509/x509_req.c

index ab13bcfc061de518c86bcb108bb0fd8d920576c4..3872e1fb64a5711a8549d0a9836d347af62e1b77 100644 (file)
@@ -242,6 +242,11 @@ int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts,
        at = NULL;
        attr->single = 0;
        attr->object = OBJ_nid2obj(nid);
+       if (!req->req_info->attributes)
+               {
+               if (!(req->req_info->attributes = sk_X509_ATTRIBUTE_new_null()))
+                       goto err;
+               }
        if(!sk_X509_ATTRIBUTE_push(req->req_info->attributes, attr)) goto err;
        return 1;
        err: