CC: curl: fix some security vulnerabilities
[15.05/openwrt.git] / package / network / utils / curl / patches / 011-CVE-2015-3144.patch
1 From 6218ded6001ea330e589f92b6b2fa12777752b5d Mon Sep 17 00:00:00 2001
2 From: Daniel Stenberg <daniel@haxx.se>
3 Date: Thu, 16 Apr 2015 23:52:04 +0200
4 Subject: [PATCH] fix_hostname: zero length host name caused -1 index offset
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 If a URL is given with a zero-length host name, like in "http://:80" or
10 just ":80", `fix_hostname()` will index the host name pointer with a -1
11 offset (as it blindly assumes a non-zero length) and both read and
12 assign that address.
13
14 CVE-2015-3144
15
16 Bug: http://curl.haxx.se/docs/adv_20150422D.html
17 Reported-by: Hanno Böck
18 ---
19  lib/url.c | 2 +-
20  1 file changed, 1 insertion(+), 1 deletion(-)
21
22 --- a/lib/url.c
23 +++ b/lib/url.c
24 @@ -3606,7 +3606,7 @@ static void fix_hostname(struct SessionH
25    host->dispname = host->name;
26  
27    len = strlen(host->name);
28 -  if(host->name[len-1] == '.')
29 +  if(len && (host->name[len-1] == '.'))
30      /* strip off a single trailing dot if present, primarily for SNI but
31         there's no use for it */
32      host->name[len-1]=0;