summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509/x509_trs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/x509/x509_trs.c')
-rw-r--r--src/lib/libcrypto/x509/x509_trs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509_trs.c b/src/lib/libcrypto/x509/x509_trs.c
index 544fb5e884..d4e6be65e6 100644
--- a/src/lib/libcrypto/x509/x509_trs.c
+++ b/src/lib/libcrypto/x509/x509_trs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_trs.c,v 1.16 2014/09/28 10:52:59 miod Exp $ */ 1/* $OpenBSD: x509_trs.c,v 1.17 2014/10/16 03:19:02 beck Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -57,6 +57,7 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <string.h>
60 61
61#include <openssl/err.h> 62#include <openssl/err.h>
62#include <openssl/x509v3.h> 63#include <openssl/x509v3.h>
@@ -202,7 +203,7 @@ X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int),
202 if (trtmp->flags & X509_TRUST_DYNAMIC_NAME) 203 if (trtmp->flags & X509_TRUST_DYNAMIC_NAME)
203 free(trtmp->name); 204 free(trtmp->name);
204 /* dup supplied name */ 205 /* dup supplied name */
205 if ((trtmp->name = BUF_strdup(name)) == NULL) 206 if (name == NULL || (trtmp->name = strdup(name)) == NULL)
206 goto err; 207 goto err;
207 /* Keep the dynamic flag of existing entry */ 208 /* Keep the dynamic flag of existing entry */
208 trtmp->flags &= X509_TRUST_DYNAMIC; 209 trtmp->flags &= X509_TRUST_DYNAMIC;