aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/x509v3/pcy_node.c
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2018-03-28 22:32:31 +0200
committerDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>2018-04-24 09:08:33 +0200
commit7fcdbd839c629f5419a49bf8da28c968c8140c3d (patch)
tree85e3b2f53438b4b53a8c94081f8283d78d8c2c93 /crypto/x509v3/pcy_node.c
parentd8f436f3cf771d519573460b14ece6ed01a157ff (diff)
downloadopenssl-7fcdbd839c629f5419a49bf8da28c968c8140c3d.tar.gz
X509: add more error codes on malloc or sk_TYP_push failure
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/5837)
Diffstat (limited to 'crypto/x509v3/pcy_node.c')
-rw-r--r--crypto/x509v3/pcy_node.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/crypto/x509v3/pcy_node.c b/crypto/x509v3/pcy_node.c
index 80443bff91..f7393735f2 100644
--- a/crypto/x509v3/pcy_node.c
+++ b/crypto/x509v3/pcy_node.c
@@ -10,6 +10,7 @@
#include <openssl/asn1.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
+#include <openssl/err.h>
#include "pcy_int.h"
@@ -66,8 +67,10 @@ X509_POLICY_NODE *level_add_node(X509_POLICY_LEVEL *level,
X509_POLICY_NODE *node;
node = OPENSSL_zalloc(sizeof(*node));
- if (node == NULL)
+ if (node == NULL) {
+ X509V3err(X509V3_F_LEVEL_ADD_NODE, ERR_R_MALLOC_FAILURE);
return NULL;
+ }
node->data = data;
node->parent = parent;
if (level) {
@@ -79,20 +82,28 @@ X509_POLICY_NODE *level_add_node(X509_POLICY_LEVEL *level,
if (level->nodes == NULL)
level->nodes = policy_node_cmp_new();
- if (level->nodes == NULL)
+ if (level->nodes == NULL) {
+ X509V3err(X509V3_F_LEVEL_ADD_NODE, ERR_R_MALLOC_FAILURE);
goto node_error;
- if (!sk_X509_POLICY_NODE_push(level->nodes, node))
+ }
+ if (!sk_X509_POLICY_NODE_push(level->nodes, node)) {
+ X509V3err(X509V3_F_LEVEL_ADD_NODE, ERR_R_MALLOC_FAILURE);
goto node_error;
+ }
}
}
if (tree) {
if (tree->extra_data == NULL)
tree->extra_data = sk_X509_POLICY_DATA_new_null();
- if (tree->extra_data == NULL)
+ if (tree->extra_data == NULL){
+ X509V3err(X509V3_F_LEVEL_ADD_NODE, ERR_R_MALLOC_FAILURE);
goto node_error;
- if (!sk_X509_POLICY_DATA_push(tree->extra_data, data))
+ }
+ if (!sk_X509_POLICY_DATA_push(tree->extra_data, data)) {
+ X509V3err(X509V3_F_LEVEL_ADD_NODE, ERR_R_MALLOC_FAILURE);
goto node_error;
+ }
}
if (parent)