Skip to content

Commit fb0bc2b

Browse files
Gabor Tyukaszmattcaswell
Gabor Tyukasz
authored andcommitted
Fix race condition in ssl_parse_serverhello_tlsext
CVE-2014-3509 Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
1 parent 0042fb5 commit fb0bc2b

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

ssl/t1_lib.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2647,15 +2647,18 @@ static int ssl_scan_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char
26472647
*al = TLS1_AD_DECODE_ERROR;
26482648
return 0;
26492649
}
2650-
s->session->tlsext_ecpointformatlist_length = 0;
2651-
if (s->session->tlsext_ecpointformatlist != NULL) OPENSSL_free(s->session->tlsext_ecpointformatlist);
2652-
if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL)
2650+
if (!s->hit)
26532651
{
2654-
*al = TLS1_AD_INTERNAL_ERROR;
2655-
return 0;
2652+
s->session->tlsext_ecpointformatlist_length = 0;
2653+
if (s->session->tlsext_ecpointformatlist != NULL) OPENSSL_free(s->session->tlsext_ecpointformatlist);
2654+
if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL)
2655+
{
2656+
*al = TLS1_AD_INTERNAL_ERROR;
2657+
return 0;
2658+
}
2659+
s->session->tlsext_ecpointformatlist_length = ecpointformatlist_length;
2660+
memcpy(s->session->tlsext_ecpointformatlist, sdata, ecpointformatlist_length);
26562661
}
2657-
s->session->tlsext_ecpointformatlist_length = ecpointformatlist_length;
2658-
memcpy(s->session->tlsext_ecpointformatlist, sdata, ecpointformatlist_length);
26592662
#if 0
26602663
fprintf(stderr,"ssl_parse_serverhello_tlsext s->session->tlsext_ecpointformatlist ");
26612664
sdata = s->session->tlsext_ecpointformatlist;

0 commit comments

Comments
 (0)