PR: 1864
authorDr. Stephen Henson <steve@openssl.org>
Sat, 14 Mar 2009 12:39:05 +0000 (12:39 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 14 Mar 2009 12:39:05 +0000 (12:39 +0000)
Submitted by: Ger Hobbelt <ger@hobbelt.com>
Reviewed by: steve@openssl.org

Check return value.

crypto/x509v3/v3_cpols.c

index 7573fec..b452ac4 100644 (file)
@@ -181,7 +181,11 @@ static STACK_OF(POLICYINFO) *r2i_certpol(X509V3_EXT_METHOD *method,
                        pol = POLICYINFO_new();
                        pol->policyid = pobj;
                }
-               sk_POLICYINFO_push(pols, pol);
+               if (!sk_POLICYINFO_push(pols, pol)){
+                       POLICYINFO_free(pol);
+                       X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_MALLOC_FAILURE);
+                       goto err;
+               }
        }
        sk_CONF_VALUE_pop_free(vals, X509V3_conf_free);
        return pols;
@@ -447,3 +451,6 @@ void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent)
                BIO_printf(out, "%*sNo Qualifiers\n", indent + 2, "");
        }
 
+
+IMPLEMENT_STACK_OF(X509_POLICY_NODE)
+