aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/evp/evp_pbe.c4
-rw-r--r--crypto/stack/stack.c5
-rw-r--r--crypto/x509v3/v3_alt.c1
-rw-r--r--crypto/x509v3/v3_prn.c9
4 files changed, 13 insertions, 6 deletions
diff --git a/crypto/evp/evp_pbe.c b/crypto/evp/evp_pbe.c
index 02ae151cf4..848edddd8c 100644
--- a/crypto/evp/evp_pbe.c
+++ b/crypto/evp/evp_pbe.c
@@ -83,8 +83,7 @@ int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
unsigned char key[EVP_MAX_KEY_LENGTH], iv[EVP_MAX_IV_LENGTH];
int i;
pbelu.pbe_nid = OBJ_obj2nid(pbe_obj);
- if ((pbelu.pbe_nid != NID_undef) && pbe_algs)
- i = sk_find (pbe_algs, (char *)&pbelu);
+ if (pbelu.pbe_nid != NID_undef) i = sk_find(pbe_algs, (char *)&pbelu);
else i = -1;
if (i == -1) {
@@ -167,4 +166,5 @@ int EVP_PBE_alg_add (int nid, EVP_CIPHER *cipher, EVP_MD *md,
void EVP_PBE_cleanup(void)
{
sk_pop_free(pbe_algs, FreeFunc);
+ pbe_algs = NULL;
}
diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c
index 242337a391..5a15a2456d 100644
--- a/crypto/stack/stack.c
+++ b/crypto/stack/stack.c
@@ -135,6 +135,7 @@ int sk_insert(STACK *st, char *data, int loc)
{
char **s;
+ if(st == NULL) return 0;
if (st->num_alloc <= st->num+1)
{
s=(char **)Realloc((char *)st->data,
@@ -183,7 +184,8 @@ char *sk_delete(STACK *st, int loc)
char *ret;
int i,j;
- if ((st->num == 0) || (loc < 0) || (loc >= st->num)) return(NULL);
+ if ((st == NULL) || (st->num == 0) || (loc < 0)
+ || (loc >= st->num)) return(NULL);
ret=st->data[loc];
if (loc != st->num-1)
@@ -206,6 +208,7 @@ int sk_find(STACK *st, char *data)
char **r;
int i;
int (*comp_func)();
+ if(st == NULL) return -1;
if (st->comp == NULL)
{
diff --git a/crypto/x509v3/v3_alt.c b/crypto/x509v3/v3_alt.c
index 99026fc8bc..e66a0748fd 100644
--- a/crypto/x509v3/v3_alt.c
+++ b/crypto/x509v3/v3_alt.c
@@ -96,6 +96,7 @@ STACK *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method,
gen = sk_GENERAL_NAME_value(gens, i);
ret = i2v_GENERAL_NAME(method, gen, ret);
}
+ if(!ret) return sk_GENERAL_NAME_new_null();
return ret;
}
diff --git a/crypto/x509v3/v3_prn.c b/crypto/x509v3/v3_prn.c
index 06a4f6964f..08e6e2cc6e 100644
--- a/crypto/x509v3/v3_prn.c
+++ b/crypto/x509v3/v3_prn.c
@@ -71,13 +71,16 @@ void X509V3_EXT_val_prn(BIO *out, STACK *val, int indent, int ml)
int i;
CONF_VALUE *nval;
if(!val) return;
- if(!ml) BIO_printf(out, "%*s", indent, "");
+ if(!ml || !sk_num(val)) {
+ BIO_printf(out, "%*s", indent, "");
+ if(!sk_num(val)) BIO_puts(out, "<EMPTY>\n");
+ }
for(i = 0; i < sk_num(val); i++) {
if(ml) BIO_printf(out, "%*s", indent, "");
else if(i > 0) BIO_printf(out, ", ");
nval = (CONF_VALUE *)sk_value(val, i);
- if(!nval->name) BIO_printf(out, "%s", nval->value);
- else if(!nval->value) BIO_printf(out, "%s", nval->name);
+ if(!nval->name) BIO_puts(out, nval->value);
+ else if(!nval->value) BIO_puts(out, nval->name);
else BIO_printf(out, "%s:%s", nval->name, nval->value);
if(ml) BIO_puts(out, "\n");
}