components/curl/patches/014-CVE-2014-3613-part2.patch
changeset 2077 6efd64347fb0
equal deleted inserted replaced
2076:451fed2162a2 2077:6efd64347fb0
       
     1 From ceab2ea8f0c0fc4c4be219240ccf99ddc2de7b22 Mon Sep 17 00:00:00 2001
       
     2 From: Daniel Stenberg <[email protected]>
       
     3 Date: Tue, 19 Aug 2014 21:11:20 +0200
       
     4 Subject: [PATCH 2/2] cookies: reject incoming cookies set for TLDs
       
     5 
       
     6 Test 61 was modified to verify this.
       
     7 
       
     8 Reported-by: Tim Ruehsen
       
     9 ---
       
    10  lib/cookie.c      | 6 ++++++
       
    11  tests/data/test61 | 1 +
       
    12  2 files changed, 7 insertions(+)
       
    13 
       
    14 This problem has been fixed upstream in curl version 7.38.0
       
    15 
       
    16 --- lib/cookie.c.orig	2014-09-02 16:45:06.782110349 -0700
       
    17 +++ lib/cookie.c	2014-09-02 16:46:23.252037990 -0700
       
    18 @@ -314,6 +314,7 @@
       
    19          }
       
    20          else if(Curl_raw_equal("domain", name)) {
       
    21            bool is_ip;
       
    22 +          const char *dotp;
       
    23  
       
    24            /* note that this name may or may not have a preceding dot, but
       
    25               we don't care about that, we treat the names the same anyway */
       
    26 @@ -360,6 +361,11 @@
       
    27  
       
    28              is_ip = isip(domain ? domain : whatptr);
       
    29  
       
    30 +            /* check for more dots */
       
    31 +            dotp = strchr(whatptr, '.');
       
    32 +            if(!dotp)
       
    33 +              domain=":";
       
    34 +
       
    35              if(!domain
       
    36                 || (is_ip && !strcmp(whatptr, domain))
       
    37                 || (!is_ip && tailmatch(whatptr, domain))) {
       
    38 --- tests/data/test61.orig	2014-09-02 16:22:41.267624972 -0700
       
    39 +++ tests/data/test61	2014-09-02 16:47:10.419615833 -0700
       
    40 @@ -23,6 +23,7 @@
       
    41  Set-Cookie: test4=no; domain=nope.foo.com; path=/moo; secure
       
    42  Set-Cookie: test5=name; domain=anything.com; path=/ ; secure
       
    43  Set-Cookie: fake=fooledyou; domain=..com; path=/;
       
    44 +Set-Cookie: supercookie=fooledyou; domain=.com; path=/;
       
    45  Content-Length: 4
       
    46  
       
    47  boo