diff options
author | Nils Larsch <nils@openssl.org> | 2005-07-26 21:10:34 +0000 |
---|---|---|
committer | Nils Larsch <nils@openssl.org> | 2005-07-26 21:10:34 +0000 |
commit | c755c5fd8ba5771691451e9d1b163544fdadb7ec (patch) | |
tree | e9ba80b2ad6965f3803a0d2273b8797258023586 /crypto/x509 | |
parent | 5c8e9139d18ca20fd4a6f194697d2e2634009cca (diff) |
improved error checking and some fixes
PR: 1170
Submitted by: Yair Elharrar
Reviewed and edited by: Nils Larsch
Diffstat (limited to 'crypto/x509')
-rw-r--r-- | crypto/x509/x509_att.c | 10 | ||||
-rw-r--r-- | crypto/x509/x509_v3.c | 10 |
2 files changed, 16 insertions, 4 deletions
diff --git a/crypto/x509/x509_att.c b/crypto/x509/x509_att.c index bd1fdec207..65968c4944 100644 --- a/crypto/x509/x509_att.c +++ b/crypto/x509/x509_att.c @@ -125,7 +125,13 @@ STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, X509_ATTRIBUTE *new_attr=NULL; STACK_OF(X509_ATTRIBUTE) *sk=NULL; - if ((x != NULL) && (*x == NULL)) + if (x == NULL) + { + X509err(X509_F_X509AT_ADD1_ATTR, ERR_R_PASSED_NULL_PARAMETER); + goto err2; + } + + if (*x == NULL) { if ((sk=sk_X509_ATTRIBUTE_new_null()) == NULL) goto err; @@ -137,7 +143,7 @@ STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, goto err2; if (!sk_X509_ATTRIBUTE_push(sk,new_attr)) goto err; - if ((x != NULL) && (*x == NULL)) + if (*x == NULL) *x=sk; return(sk); err: diff --git a/crypto/x509/x509_v3.c b/crypto/x509/x509_v3.c index 67b1796a92..42e6f0ab05 100644 --- a/crypto/x509/x509_v3.c +++ b/crypto/x509/x509_v3.c @@ -147,7 +147,13 @@ STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, int n; STACK_OF(X509_EXTENSION) *sk=NULL; - if ((x != NULL) && (*x == NULL)) + if (x == NULL) + { + X509err(X509_F_X509V3_ADD_EXT,ERR_R_PASSED_NULL_PARAMETER); + goto err2; + } + + if (*x == NULL) { if ((sk=sk_X509_EXTENSION_new_null()) == NULL) goto err; @@ -163,7 +169,7 @@ STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, goto err2; if (!sk_X509_EXTENSION_insert(sk,new_ex,loc)) goto err; - if ((x != NULL) && (*x == NULL)) + if (*x == NULL) *x=sk; return(sk); err: |