check ASN1 type before using it

This commit is contained in:
Dr. Stephen Henson 2010-04-14 00:30:32 +00:00
parent 934e22e814
commit af73b08ac0

View File

@ -459,13 +459,15 @@ int gost89_get_asn1_parameters(EVP_CIPHER_CTX *ctx,ASN1_TYPE *params)
int ret = -1; int ret = -1;
int len; int len;
GOST_CIPHER_PARAMS *gcp = NULL; GOST_CIPHER_PARAMS *gcp = NULL;
unsigned char *p = params->value.sequence->data; unsigned char *p;
struct ossl_gost_cipher_ctx *c=ctx->cipher_data; struct ossl_gost_cipher_ctx *c=ctx->cipher_data;
if (ASN1_TYPE_get(params) != V_ASN1_SEQUENCE) if (ASN1_TYPE_get(params) != V_ASN1_SEQUENCE)
{ {
return ret; return ret;
} }
p = params->value.sequence->data;
gcp = d2i_GOST_CIPHER_PARAMS(NULL, (const unsigned char **)&p, gcp = d2i_GOST_CIPHER_PARAMS(NULL, (const unsigned char **)&p,
params->value.sequence->length); params->value.sequence->length);