Security fix for CVE-2013-1944 curl: Cookie domain suffix match vulnerability
ok naddy@ (MAINTAINER)
This commit is contained in:
parent
017e31dfd7
commit
ef222239f0
@ -1,9 +1,9 @@
|
||||
# $OpenBSD: Makefile,v 1.88 2013/03/21 08:46:33 ajacoutot Exp $
|
||||
# $OpenBSD: Makefile,v 1.89 2013/05/07 06:53:26 jasper Exp $
|
||||
|
||||
COMMENT= get files from FTP, Gopher, HTTP or HTTPS servers
|
||||
|
||||
DISTNAME= curl-7.26.0
|
||||
REVISION= 1
|
||||
REVISION= 2
|
||||
SHARED_LIBS= curl 23.0 # .6.0
|
||||
CATEGORIES= net
|
||||
MASTER_SITES= http://curl.haxx.se/download/ \
|
||||
|
42
net/curl/patches/patch-lib_cookie_c
Normal file
42
net/curl/patches/patch-lib_cookie_c
Normal file
@ -0,0 +1,42 @@
|
||||
$OpenBSD: patch-lib_cookie_c,v 1.1 2013/05/07 06:53:26 jasper Exp $
|
||||
|
||||
Security fix for CVE-2013-1944 curl: Cookie domain suffix match vulnerability
|
||||
Patch from http://curl.haxx.se/curl-tailmatch.patch
|
||||
|
||||
--- lib/cookie.c.orig Thu Mar 8 20:35:24 2012
|
||||
+++ lib/cookie.c Mon May 6 16:17:34 2013
|
||||
@@ -118,15 +118,29 @@ static void freecookie(struct Cookie *co)
|
||||
free(co);
|
||||
}
|
||||
|
||||
-static bool tailmatch(const char *little, const char *bigone)
|
||||
+static bool tailmatch(const char *cooke_domain, const char *hostname)
|
||||
{
|
||||
- size_t littlelen = strlen(little);
|
||||
- size_t biglen = strlen(bigone);
|
||||
+ size_t cookie_domain_len = strlen(cooke_domain);
|
||||
+ size_t hostname_len = strlen(hostname);
|
||||
|
||||
- if(littlelen > biglen)
|
||||
+ if(hostname_len < cookie_domain_len)
|
||||
return FALSE;
|
||||
|
||||
- return Curl_raw_equal(little, bigone+biglen-littlelen) ? TRUE : FALSE;
|
||||
+ if(!Curl_raw_equal(cooke_domain, hostname+hostname_len-cookie_domain_len))
|
||||
+ return FALSE;
|
||||
+
|
||||
+ /* A lead char of cookie_domain is not '.'.
|
||||
+ RFC6265 4.1.2.3. The Domain Attribute says:
|
||||
+ For example, if the value of the Domain attribute is
|
||||
+ "example.com", the user agent will include the cookie in the Cookie
|
||||
+ header when making HTTP requests to example.com, www.example.com, and
|
||||
+ www.corp.example.com.
|
||||
+ */
|
||||
+ if(hostname_len == cookie_domain_len)
|
||||
+ return TRUE;
|
||||
+ if('.' == *(hostname + hostname_len - cookie_domain_len - 1))
|
||||
+ return TRUE;
|
||||
+ return FALSE;
|
||||
}
|
||||
|
||||
/*
|
Loading…
Reference in New Issue
Block a user