openssl: fix CVE-2014-3569
[openwrt/svn-archive/archive.git] / package / libs / openssl / patches / 001-fix-CVE-2014-3569.patch
1 From: Kurt Roeckx <kurt@roeckx.be>
2 Date: Tue, 21 Oct 2014 18:45:15 +0000 (+0200)
3 Subject: Keep old method in case of an unsupported protocol
4 X-Git-Url: http://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=392fa7a952e97d82eac6958c81ed1e256e6b8ca5
5
6 Keep old method in case of an unsupported protocol
7
8 When we're configured with no-ssl3 and we receive an SSL v3 Client Hello, we set
9 the method to NULL. We didn't used to do that, and it breaks things. This is a
10 regression introduced in 62f45cc27d07187b59551e4fad3db4e52ea73f2c. Keep the old
11 method since the code is not able to deal with a NULL method at this time.
12
13 CVE-2014-3569, PR#3571
14
15 Reviewed-by: Emilia Käsper <emilia@openssl.org>
16 ---
17
18 diff --git a/ssl/s23_srvr.c b/ssl/s23_srvr.c
19 index 38960ba..858420d 100644
20 --- a/ssl/s23_srvr.c
21 +++ b/ssl/s23_srvr.c
22 @@ -615,12 +615,14 @@ int ssl23_get_client_hello(SSL *s)
23 if ((type == 2) || (type == 3))
24 {
25 /* we have SSLv3/TLSv1 (type 2: SSL2 style, type 3: SSL3/TLS style) */
26 - s->method = ssl23_get_server_method(s->version);
27 - if (s->method == NULL)
28 + const SSL_METHOD *new_method;
29 + new_method = ssl23_get_server_method(s->version);
30 + if (new_method == NULL)
31 {
32 SSLerr(SSL_F_SSL23_GET_CLIENT_HELLO,SSL_R_UNSUPPORTED_PROTOCOL);
33 goto err;
34 }
35 + s->method = new_method;
36
37 if (!ssl_init_wbio_buffer(s,1)) goto err;
38