From: Howard Chu Date: Fri, 30 Sep 2011 07:41:13 +0000 (-0700) Subject: ITS#7051 fix GNUtls cert dn parse X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9b082bf7162d764ec9ca83969a7a3a66032d39c5;p=openldap ITS#7051 fix GNUtls cert dn parse --- diff --git a/libraries/libldap/tls_g.c b/libraries/libldap/tls_g.c index 5a5cf658ed..17aca4c359 100644 --- a/libraries/libldap/tls_g.c +++ b/libraries/libldap/tls_g.c @@ -530,9 +530,11 @@ tlsg_x509_cert_dn( struct berval *cert, struct berval *dn, int get_subject ) ber_init2( ber, cert, LBER_USE_DER ); tag = ber_skip_tag( ber, &len ); /* Sequence */ tag = ber_skip_tag( ber, &len ); /* Sequence */ - tag = ber_skip_tag( ber, &len ); /* Context + Constructed (version) */ - if ( tag == 0xa0 ) /* Version is optional */ + tag = ber_peek_tag( ber, &len ); /* Context + Constructed (version) */ + if ( tag == 0xa0 ) { /* Version is optional */ + tag = ber_skip_tag( ber, &len ); tag = ber_get_int( ber, &i ); /* Int: Version */ + } tag = ber_skip_tag( ber, &len ); /* Int: Serial (can be longer than ber_int_t) */ ber_skip_data( ber, len ); tag = ber_skip_tag( ber, &len ); /* Sequence: Signature */