improved error checking and some fixes
[openssl.git] / crypto / x509v3 / v3_alt.c
index e3a19bf8a497c2ec9c47cffd4ffc94ed51ea068a..b38b3dbfe62baffd7a4c8e956e4e16442f886f59 100644 (file)
@@ -341,7 +341,8 @@ static int copy_email(X509V3_CTX *ctx, GENERAL_NAMES *gens, int move_p)
        X509_NAME_ENTRY *ne;
        GENERAL_NAME *gen = NULL;
        int i;
-       if(ctx->flags == CTX_TEST) return 1;
+       if(ctx != NULL && ctx->flags == CTX_TEST)
+               return 1;
        if(!ctx || (!ctx->subject_cert && !ctx->subject_req)) {
                X509V3err(X509V3_F_COPY_EMAIL,X509V3_R_NO_SUBJECT_DETAILS);
                goto err;