From 3bd1690bfb59b014fafa93b22e737e50c7db4b5b Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Fri, 21 Sep 2007 13:40:51 +0000 Subject: [PATCH] Fixes from HEAD. --- ssl/s23_clnt.c | 9 +++++++++ ssl/s3_lib.c | 1 + ssl/t1_lib.c | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ssl/s23_clnt.c b/ssl/s23_clnt.c index 146e1e17c1..a596e7b2ec 100644 --- a/ssl/s23_clnt.c +++ b/ssl/s23_clnt.c @@ -223,6 +223,15 @@ static int ssl23_client_hello(SSL *s) { version = SSL2_VERSION; } +#ifndef OPENSSL_NO_TLSEXT + if (version != SSL2_VERSION) + { + /* have to disable SSL 2.0 compatibility if we need TLS extensions */ + + if (s->tlsext_hostname != NULL) + ssl2_compat = 0; + } +#endif buf=(unsigned char *)s->init_buf->data; if (s->state == SSL23_ST_CW_CLNT_HELLO_A) diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 4f22925df1..2bacb2601e 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -1935,6 +1935,7 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) break; case SSL_CTRL_SET_TLSEXT_DEBUG_ARG: s->tlsext_debug_arg=parg; + ret = 1; break; #endif /* !OPENSSL_NO_TLSEXT */ default: diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 1c4e151fe1..21ddcc6116 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -150,7 +150,7 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned cha + hostname length */ - if ((lenmax = limit - p - 9) < 0 + if ((lenmax = limit - ret - 9) < 0 || (size_str = strlen(s->tlsext_hostname)) > (unsigned long)lenmax) return NULL; @@ -179,7 +179,7 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned cha /* Check for enough room 2 for extension type, 2 for len * rest for ticket */ - if (limit - p - 4 - ticklen < 0) + if (limit - ret - 4 - ticklen < 0) return NULL; s2n(TLSEXT_TYPE_session_ticket,ret); s2n(ticklen,ret);