diff options
Diffstat (limited to 'src/lib/libssl/s3_clnt.c')
-rw-r--r-- | src/lib/libssl/s3_clnt.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/libssl/s3_clnt.c b/src/lib/libssl/s3_clnt.c index 7a327a76a3..f39ae7fab3 100644 --- a/src/lib/libssl/s3_clnt.c +++ b/src/lib/libssl/s3_clnt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s3_clnt.c,v 1.148 2016/12/04 14:25:44 jsing Exp $ */ | 1 | /* $OpenBSD: s3_clnt.c,v 1.149 2016/12/04 14:32:30 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -588,8 +588,11 @@ int | |||
588 | ssl3_client_hello(SSL *s) | 588 | ssl3_client_hello(SSL *s) |
589 | { | 589 | { |
590 | unsigned char *bufend, *p, *d; | 590 | unsigned char *bufend, *p, *d; |
591 | size_t outlen; | ||
591 | int i; | 592 | int i; |
592 | 593 | ||
594 | bufend = (unsigned char *)s->init_buf->data + SSL3_RT_MAX_PLAIN_LENGTH; | ||
595 | |||
593 | if (s->state == SSL3_ST_CW_CLNT_HELLO_A) { | 596 | if (s->state == SSL3_ST_CW_CLNT_HELLO_A) { |
594 | SSL_SESSION *sess = s->session; | 597 | SSL_SESSION *sess = s->session; |
595 | 598 | ||
@@ -678,22 +681,22 @@ ssl3_client_hello(SSL *s) | |||
678 | } | 681 | } |
679 | 682 | ||
680 | /* Ciphers supported */ | 683 | /* Ciphers supported */ |
681 | i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2]); | 684 | if (!ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2], |
682 | if (i == 0) { | 685 | bufend - &p[2], &outlen)) |
686 | goto err; | ||
687 | if (outlen == 0) { | ||
683 | SSLerr(SSL_F_SSL3_CLIENT_HELLO, | 688 | SSLerr(SSL_F_SSL3_CLIENT_HELLO, |
684 | SSL_R_NO_CIPHERS_AVAILABLE); | 689 | SSL_R_NO_CIPHERS_AVAILABLE); |
685 | goto err; | 690 | goto err; |
686 | } | 691 | } |
687 | s2n(i, p); | 692 | s2n(outlen, p); |
688 | p += i; | 693 | p += outlen; |
689 | 694 | ||
690 | /* add in (no) COMPRESSION */ | 695 | /* add in (no) COMPRESSION */ |
691 | *(p++) = 1; | 696 | *(p++) = 1; |
692 | *(p++) = 0; /* Add the NULL method */ | 697 | *(p++) = 0; /* Add the NULL method */ |
693 | 698 | ||
694 | /* TLS extensions*/ | 699 | /* TLS extensions*/ |
695 | bufend = (unsigned char *)s->init_buf->data + | ||
696 | SSL3_RT_MAX_PLAIN_LENGTH; | ||
697 | if ((p = ssl_add_clienthello_tlsext(s, p, bufend)) == NULL) { | 700 | if ((p = ssl_add_clienthello_tlsext(s, p, bufend)) == NULL) { |
698 | SSLerr(SSL_F_SSL3_CLIENT_HELLO, | 701 | SSLerr(SSL_F_SSL3_CLIENT_HELLO, |
699 | ERR_R_INTERNAL_ERROR); | 702 | ERR_R_INTERNAL_ERROR); |