summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Tyukasz <Gabor.Tyukasz@logmein.com>2014-07-23 23:42:06 +0200
committerMatt Caswell <matt@openssl.org>2014-08-06 20:27:51 +0100
commit86788e1ee6908a5b3a4c95fa80caa4b724a8a434 (patch)
tree1ba75887255f1930de88bde2319033df98ade943
parent03b04ddac162c7b7fa3c57eadccc5a583a00d291 (diff)
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>
-rw-r--r--ssl/t1_lib.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index 8167a51e5c..022a4fb289 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -1555,15 +1555,18 @@ int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
*al = TLS1_AD_DECODE_ERROR;
return 0;
}
- s->session->tlsext_ecpointformatlist_length = 0;
- if (s->session->tlsext_ecpointformatlist != NULL) OPENSSL_free(s->session->tlsext_ecpointformatlist);
- if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL)
+ if (!s->hit)
{
- *al = TLS1_AD_INTERNAL_ERROR;
- return 0;
+ s->session->tlsext_ecpointformatlist_length = 0;
+ if (s->session->tlsext_ecpointformatlist != NULL) OPENSSL_free(s->session->tlsext_ecpointformatlist);
+ if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL)
+ {
+ *al = TLS1_AD_INTERNAL_ERROR;
+ return 0;
+ }
+ s->session->tlsext_ecpointformatlist_length = ecpointformatlist_length;
+ memcpy(s->session->tlsext_ecpointformatlist, sdata, ecpointformatlist_length);
}
- s->session->tlsext_ecpointformatlist_length = ecpointformatlist_length;
- memcpy(s->session->tlsext_ecpointformatlist, sdata, ecpointformatlist_length);
#if 0
fprintf(stderr,"ssl_parse_serverhello_tlsext s->session->tlsext_ecpointformatlist ");
sdata = s->session->tlsext_ecpointformatlist;