From 686bfae2440714a6ac1bed19bf4a98fd04e688b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 15 Aug 2013 13:40:10 +0200 Subject: [PATCH] Fix memory error in x509_get_attr_type_value --- library/x509parse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/x509parse.c b/library/x509parse.c index ace7fe8b0..6d7d08df7 100644 --- a/library/x509parse.c +++ b/library/x509parse.c @@ -287,6 +287,10 @@ static int x509_get_attr_type_value( unsigned char **p, ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ) != 0 ) return( POLARSSL_ERR_X509_CERT_INVALID_NAME + ret ); + if( ( end - *p ) < 1 ) + return( POLARSSL_ERR_X509_CERT_INVALID_NAME + + POLARSSL_ERR_ASN1_OUT_OF_DATA ); + oid = &cur->oid; oid->tag = **p;