Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / openssl / openssl / ssl / s23_clnt.c
index 08ee86d..750d208 100644 (file)
@@ -467,9 +467,9 @@ static int ssl23_client_hello(SSL *s)
                        /* create Client Hello in SSL 3.0/TLS 1.0 format */
 
                        /* do the record header (5 bytes) and handshake message
-                        * header (4 bytes) last. Note: the code to add the
-                        * padding extension in t1_lib.c depends on the size of
-                        * this prefix. */
+                        * header (4 bytes) last. Note: the final argument to
+                        * ssl_add_clienthello_tlsext below depends on the size
+                        * of this prefix. */
                        d = p = &(buf[9]);
                        
                        *(p++) = version_major;
@@ -526,7 +526,10 @@ static int ssl23_client_hello(SSL *s)
                                SSLerr(SSL_F_SSL23_CLIENT_HELLO,SSL_R_CLIENTHELLO_TLSEXT);
                                return -1;
                                }
-                       if ((p = ssl_add_clienthello_tlsext(s, p, buf+SSL3_RT_MAX_PLAIN_LENGTH)) == NULL)
+                       /* The buffer includes the 5 byte record header, so
+                        * subtract it to compute hlen for
+                        * ssl_add_clienthello_tlsext. */
+                       if ((p = ssl_add_clienthello_tlsext(s, p, buf+SSL3_RT_MAX_PLAIN_LENGTH, p-buf-5)) == NULL)
                                {
                                SSLerr(SSL_F_SSL23_CLIENT_HELLO,ERR_R_INTERNAL_ERROR);
                                return -1;