From: Nils Larsch Date: Mon, 4 Dec 2006 19:10:58 +0000 (+0000) Subject: allocate a new attributes entry in X509_REQ_add_extensions() X-Git-Tag: OpenSSL_0_9_8e~54 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c786aa6c8c857b18ea48cbb80ec6c0423370c89;p=openssl allocate a new attributes entry in X509_REQ_add_extensions() if it's NULL (in case of a malformed pkcs10 request) PR: 1347 Submitted by: Remo Inverardi --- diff --git a/crypto/x509/x509_req.c b/crypto/x509/x509_req.c index ab13bcfc06..3872e1fb64 100644 --- a/crypto/x509/x509_req.c +++ b/crypto/x509/x509_req.c @@ -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: