summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2020-12-07 13:28:39 +0100
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>2020-12-10 15:19:55 +0100
commitf902716f24ab13a02ab501fde9428f996fd4b0cd (patch)
tree012c98645e678a2c804e7a2ed30e5c594a0c2e75
parent374f72cedd2f26d197c208ae56571fd2123fe9ce (diff)
X509V3_EXT_add_nconf_sk(): Improve description and use of 'sk' arg, which may be NULL
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13614)
-rw-r--r--crypto/x509/v3_conf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/x509/v3_conf.c b/crypto/x509/v3_conf.c
index 47b626659c..1f424325a0 100644
--- a/crypto/x509/v3_conf.c
+++ b/crypto/x509/v3_conf.c
@@ -305,7 +305,7 @@ static void delete_ext(STACK_OF(X509_EXTENSION) *sk, X509_EXTENSION *dext)
/*
* This is the main function: add a bunch of extensions based on a config
- * file section to an extension STACK.
+ * file section to an extension STACK. Just check in case sk == NULL.
*/
int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section,
@@ -323,9 +323,9 @@ int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section,
if ((ext = X509V3_EXT_nconf_int(conf, ctx, val->section,
val->name, val->value)) == NULL)
return 0;
- if (ctx->flags == X509V3_CTX_REPLACE)
- delete_ext(*sk, ext);
if (sk != NULL) {
+ if (ctx->flags == X509V3_CTX_REPLACE)
+ delete_ext(*sk, ext);
if (X509v3_add_ext(sk, ext, -1) == NULL) {
X509_EXTENSION_free(ext);
return 0;