summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compat-libcurl3.spec17
-rw-r--r--curl-7.15.5-CVE-2013-1944.patch332
-rw-r--r--curl-7.15.5-CVE-2013-2174.patch268
3 files changed, 615 insertions, 2 deletions
diff --git a/compat-libcurl3.spec b/compat-libcurl3.spec
index 1f593ed..622a5b7 100644
--- a/compat-libcurl3.spec
+++ b/compat-libcurl3.spec
@@ -1,9 +1,9 @@
-%global rhelrel 15-el5
+%global rhelrel 17-el5_9
Summary: A utility for getting files from remote servers (FTP, HTTP, and others).
Name: compat-libcurl3
Version: 7.15.5
-Release: 2%{?dist}
+Release: 3%{?dist}
License: MIT
Group: Applications/Internet
Source: http://curl.haxx.se/download/curl-%{version}.tar.bz2
@@ -25,6 +25,8 @@ Patch14: curl-7.15.5-bz652557.patch
Patch15: curl-7.15.5-bz657396.patch
Patch16: curl-7.15.5-bz688871.patch
Patch17: curl-7.15.5-bz746849.patch
+Patch18: curl-7.15.5-CVE-2013-1944.patch
+Patch19: curl-7.15.5-CVE-2013-2174.patch
URL: http://curl.haxx.se/
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: openssl-devel, libtool, pkgconfig, libidn-devel
@@ -76,6 +78,8 @@ rm -rf $RPM_BUILD_ROOT
%patch15 -p1 -b .bz657396
%patch16 -p1 -b .bz688871
%patch17 -p1 -b .bz746849
+%patch18 -p1 -b .CVE-2013-1944
+%patch19 -p1 -b .CVE-2013-2174
%build
aclocal
@@ -132,6 +136,15 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man3/*
%changelog
+* Tue Oct 22 2013 Remi Collet <RPMS@FamilleCollet.com> - 7.15.5-3
+- sync with curl 7.15.5-17
+
+* Fri Jun 14 2013 Kamil Dudka <kdudka@redhat.com> 7.15.5-17
+- fix heap-based buffer overflow in curl_easy_unescape() (CVE-2013-2174)
+
+* Sat Apr 13 2013 Kamil Dudka <kdudka@redhat.com> 7.15.5-16
+- fix cookie tailmatching to prevent cross-domain leakage (CVE-2013-1944)
+
* Sun Jun 24 2012 Remi Collet <RPMS@FamilleCollet.com> - 7.15.5-2
- sync with curl 7.15.5-15
diff --git a/curl-7.15.5-CVE-2013-1944.patch b/curl-7.15.5-CVE-2013-1944.patch
new file mode 100644
index 0000000..d6062ce
--- /dev/null
+++ b/curl-7.15.5-CVE-2013-1944.patch
@@ -0,0 +1,332 @@
+From 3ecd4749cf14d33240d3b6e89d7014699881b8a1 Mon Sep 17 00:00:00 2001
+From: Yang Tse <yangsita@gmail.com>
+Date: Fri, 2 Feb 2007 01:36:08 +0000
+Subject: [PATCH 1/5] fix test case 62 which was failing due to cookies expiring 1 Feb 2007
+
+
+Signed-off-by: Kamil Dudka <kdudka@redhat.com>
+---
+ tests/data/test62 | 6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tests/data/test62 b/tests/data/test62
+index 6d01f88..847a0ab 100644
+--- a/tests/data/test62
++++ b/tests/data/test62
+@@ -32,9 +32,9 @@ http://%HOSTIP:%HTTPPORT/we/want/62 -b log/jar62.txt -H "Host: www.host.foo.com"
+ # http://www.netscape.com/newsref/std/cookie_spec.html
+ # This file was generated by libcurl! Edit at your own risk.
+
+-.foo.com TRUE /we/want/ FALSE 1170327387 test yes
+-.host.foo.com TRUE /we/want/ FALSE 1170327387 test2 yes
+-.fake.host.foo.com TRUE /we/want/ FALSE 1170327387 test4 yes
++.foo.com TRUE /we/want/ FALSE 2147483647 test yes
++.host.foo.com TRUE /we/want/ FALSE 2147483647 test2 yes
++.fake.host.foo.com TRUE /we/want/ FALSE 2147483647 test4 yes
+
+ .foo.com TRUE /moo TRUE 0 test3 maybe
+ </file>
+--
+1.7.1
+
+
+From 4feeba0a65d65a390a7d53e3212e3fe2b589e339 Mon Sep 17 00:00:00 2001
+From: Yang Tse <yangsita@gmail.com>
+Date: Mon, 5 Feb 2007 02:38:25 +0000
+Subject: [PATCH 2/5] Year 2038 has its own problems (32 bit integer overflow). So cookie expiration date is lowered to expire at most in 2035.
+
+
+Signed-off-by: Kamil Dudka <kdudka@redhat.com>
+---
+ tests/data/test62 | 6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tests/data/test62 b/tests/data/test62
+index 847a0ab..d3d0715 100644
+--- a/tests/data/test62
++++ b/tests/data/test62
+@@ -32,9 +32,9 @@ http://%HOSTIP:%HTTPPORT/we/want/62 -b log/jar62.txt -H "Host: www.host.foo.com"
+ # http://www.netscape.com/newsref/std/cookie_spec.html
+ # This file was generated by libcurl! Edit at your own risk.
+
+-.foo.com TRUE /we/want/ FALSE 2147483647 test yes
+-.host.foo.com TRUE /we/want/ FALSE 2147483647 test2 yes
+-.fake.host.foo.com TRUE /we/want/ FALSE 2147483647 test4 yes
++.foo.com TRUE /we/want/ FALSE 2054030187 test yes
++.host.foo.com TRUE /we/want/ FALSE 2054030187 test2 yes
++.fake.host.foo.com TRUE /we/want/ FALSE 2054030187 test4 yes
+
+ .foo.com TRUE /moo TRUE 0 test3 maybe
+ </file>
+--
+1.7.1
+
+
+From d12cbcf4a507fd57976c3a877ab1e629a1e24677 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka <kdudka@redhat.com>
+Date: Sat, 13 Apr 2013 14:11:12 +0200
+Subject: [PATCH 3/5] test1216: test tailmatching cookie domains
+
+This test is an attempt to repeat the problem YAMADA Yasuharu reported
+at http://curl.haxx.se/mail/lib-2013-04/0108.html
+
+Conflicts:
+
+ tests/data/Makefile.am
+
+Signed-off-by: Kamil Dudka <kdudka@redhat.com>
+---
+ tests/data/Makefile.am | 2 +-
+ tests/data/test1216 | 62 ++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 63 insertions(+), 1 deletions(-)
+ create mode 100644 tests/data/test1216
+
+diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
+index 233bf03..ae555c6 100644
+--- a/tests/data/Makefile.am
++++ b/tests/data/Makefile.am
+@@ -34,5 +34,5 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
+ test250 test251 test252 test253 test254 test255 test521 test522 test523 \
+ test256 test257 test258 test259 test260 test261 test262 test263 test264 \
+ test265 test266 test267 test268 test269 test270 test271 test272 test273 \
+- test274 test275 test524 test276 test277
++ test274 test275 test524 test276 test277 test1216
+
+diff --git a/tests/data/test1216 b/tests/data/test1216
+new file mode 100644
+index 0000000..a87b812
+--- /dev/null
++++ b/tests/data/test1216
+@@ -0,0 +1,62 @@
++<info>
++<keywords>
++HTTP
++HTTP GET
++HTTP proxy
++cookies
++</keywords>
++</info>
++
++# Server-side
++<reply>
++<data>
++HTTP/1.1 200 OK
++Server: Microsoft-IIS/4.0
++Date: Tue, 25 Sep 2001 19:37:44 GMT
++Content-Type: text/html
++Connection: close
++Content-Length: 21
++
++This server says moo
++</data>
++</reply>
++
++# Client-side
++<client>
++<server>
++http
++</server>
++ <name>
++HTTP cookie domains tailmatching the host name
++ </name>
++ <command>
++http://example.fake/c/1216 http://bexample.fake/c/1216 -b log/injar1216 -x %HOSTIP:%HTTPPORT
++</command>
++<file name="log/injar1216">
++example.fake FALSE /a FALSE 2139150993 mooo indeed
++example.fake FALSE /b FALSE 0 moo1 indeed
++example.fake FALSE /c FALSE 2139150993 moo2 indeed
++</file>
++</client>
++
++# Verify data after the test has been "shot"
++<verify>
++<strip>
++^User-Agent:.*
++</strip>
++<protocol>
++GET http://example.fake/c/1216 HTTP/1.1
++Host: example.fake
++Pragma: no-cache
++Accept: */*
++Proxy-Connection: Keep-Alive
++Cookie: moo2=indeed
++
++GET http://bexample.fake/c/1216 HTTP/1.1
++Host: bexample.fake
++Pragma: no-cache
++Accept: */*
++Proxy-Connection: Keep-Alive
++
++</protocol>
++</verify>
+--
+1.7.1
+
+
+From e489a51084884148bd9c014f5fa4d9f4189a86a0 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka <kdudka@redhat.com>
+Date: Sat, 13 Apr 2013 14:12:13 +0200
+Subject: [PATCH 4/5] cookie: fix tailmatching to prevent cross-domain leakage
+
+Cookies set for 'example.com' could accidentaly also be sent by libcurl
+to the 'bexample.com' (ie with a prefix to the first domain name).
+
+This is a security vulnerabilty, CVE-2013-1944.
+
+Bug: http://curl.haxx.se/docs/adv_20130412.html
+
+Conflicts:
+
+ lib/cookie.c
+
+Signed-off-by: Kamil Dudka <kdudka@redhat.com>
+---
+ lib/cookie.c | 24 +++++++++++++++++++-----
+ 1 files changed, 19 insertions(+), 5 deletions(-)
+
+diff --git a/lib/cookie.c b/lib/cookie.c
+index 779ca4c..ddd10a6 100644
+--- a/lib/cookie.c
++++ b/lib/cookie.c
+@@ -124,15 +124,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 (bool)strequal(little, bigone+biglen-littlelen);
++ if(!strequal(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;
+ }
+
+ /*
+--
+1.7.1
+
+
+From 9f76a41483fa6737a58e32d9bca3cab1d56e5d58 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka <kdudka@redhat.com>
+Date: Sat, 13 Apr 2013 14:13:15 +0200
+Subject: [PATCH 5/5] test1218: another cookie tailmatch test
+
+These tests verify commit 3604fde3d3c9b0d, the fix for the "cookie
+domain tailmatch" vulnerability. See
+http://curl.haxx.se/docs/adv_20130412.html
+
+Conflicts:
+
+ tests/data/Makefile.am
+
+Signed-off-by: Kamil Dudka <kdudka@redhat.com>
+---
+ tests/data/Makefile.am | 2 +-
+ tests/data/test1218 | 62 ++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 63 insertions(+), 1 deletions(-)
+ create mode 100644 tests/data/test1218
+
+diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
+index ae555c6..8f2e83e 100644
+--- a/tests/data/Makefile.am
++++ b/tests/data/Makefile.am
+@@ -34,5 +34,5 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
+ test250 test251 test252 test253 test254 test255 test521 test522 test523 \
+ test256 test257 test258 test259 test260 test261 test262 test263 test264 \
+ test265 test266 test267 test268 test269 test270 test271 test272 test273 \
+- test274 test275 test524 test276 test277 test1216
++ test274 test275 test524 test276 test277 test1216 test1218
+
+diff --git a/tests/data/test1218 b/tests/data/test1218
+new file mode 100644
+index 0000000..9e2d63b
+--- /dev/null
++++ b/tests/data/test1218
+@@ -0,0 +1,62 @@
++<info>
++<keywords>
++HTTP
++HTTP GET
++HTTP proxy
++cookies
++</keywords>
++</info>
++
++# This test is very similar to 1216, only that it sets the cookies from the
++# first site instead of reading from a file
++<reply>
++<data>
++HTTP/1.1 200 OK
++Date: Tue, 25 Sep 2001 19:37:44 GMT
++Set-Cookie: domain=.example.fake; bug=fixed;
++Content-Length: 21
++
++This server says moo
++</data>
++</reply>
++
++# Client-side
++<client>
++<server>
++http
++</server>
++ <name>
++HTTP cookies and domains with same prefix
++ </name>
++ <command>
++http://example.fake/c/1218 http://example.fake/c/1218 http://bexample.fake/c/1218 -b nonexisting -x %HOSTIP:%HTTPPORT
++</command>
++</client>
++
++# Verify data after the test has been "shot"
++<verify>
++<strip>
++^User-Agent:.*
++</strip>
++<protocol>
++GET http://example.fake/c/1218 HTTP/1.1
++Host: example.fake
++Pragma: no-cache
++Accept: */*
++Proxy-Connection: Keep-Alive
++
++GET http://example.fake/c/1218 HTTP/1.1
++Host: example.fake
++Pragma: no-cache
++Accept: */*
++Proxy-Connection: Keep-Alive
++Cookie: bug=fixed
++
++GET http://bexample.fake/c/1218 HTTP/1.1
++Host: bexample.fake
++Pragma: no-cache
++Accept: */*
++Proxy-Connection: Keep-Alive
++
++</protocol>
++</verify>
+--
+1.7.1
+
diff --git a/curl-7.15.5-CVE-2013-2174.patch b/curl-7.15.5-CVE-2013-2174.patch
new file mode 100644
index 0000000..553b7d0
--- /dev/null
+++ b/curl-7.15.5-CVE-2013-2174.patch
@@ -0,0 +1,268 @@
+From ab181f4e1116322b13db55969fc5162e6a7c0114 Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <daniel@haxx.se>
+Date: Sat, 4 Aug 2007 20:47:59 +0000
+Subject: [PATCH 1/4] Patrick Monnerat fixed curl_easy_escape() and curlx_strtoll() to work on non-ASCII systems.
+
+[upstream commit 1926f4573d43f35f33b524d120e847ea819cc7c7]
+
+Signed-off-by: Kamil Dudka <kdudka@redhat.com>
+---
+ lib/escape.c | 29 ++++++++++++++++++++++-------
+ 1 files changed, 22 insertions(+), 7 deletions(-)
+
+diff --git a/lib/escape.c b/lib/escape.c
+index 18ae2e1..e0e696a 100644
+--- a/lib/escape.c
++++ b/lib/escape.c
+@@ -75,9 +75,27 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength)
+ length = alloc-1;
+ while(length--) {
+ in = *string;
+- if(!(in >= 'a' && in <= 'z') &&
+- !(in >= 'A' && in <= 'Z') &&
+- !(in >= '0' && in <= '9')) {
++
++ /* Portable character check (remember EBCDIC). Do not use isalnum() because
++ its behavior is altered by the current locale. */
++
++ switch (in) {
++ case '0': case '1': case '2': case '3': case '4':
++ case '5': case '6': case '7': case '8': case '9':
++ case 'a': case 'b': case 'c': case 'd': case 'e':
++ case 'f': case 'g': case 'h': case 'i': case 'j':
++ case 'k': case 'l': case 'm': case 'n': case 'o':
++ case 'p': case 'q': case 'r': case 's': case 't':
++ case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
++ case 'A': case 'B': case 'C': case 'D': case 'E':
++ case 'F': case 'G': case 'H': case 'I': case 'J':
++ case 'K': case 'L': case 'M': case 'N': case 'O':
++ case 'P': case 'Q': case 'R': case 'S': case 'T':
++ case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':
++ /* just copy this */
++ ns[strindex++]=in;
++ break;
++ default:
+ /* encode it */
+ newlen += 2; /* the size grows with two, since this'll become a %XX */
+ if(newlen > alloc) {
+@@ -105,10 +123,7 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength)
+ snprintf(&ns[strindex], 4, "%%%02X", in);
+
+ strindex+=3;
+- }
+- else {
+- /* just copy this */
+- ns[strindex++]=in;
++ break;
+ }
+ string++;
+ }
+--
+1.7.1
+
+
+From e2a98feff68c5ccc7c5de901f460860fc1b7ca95 Mon Sep 17 00:00:00 2001
+From: Dan Fandrich <dan@coneharvesters.com>
+Date: Tue, 9 Sep 2008 21:15:50 +0000
+Subject: [PATCH 2/4] Factored out Curl_isalnum
+
+[upstream commit c98ab69cc7aae688db604bbaad5bcc8d3fe25cba]
+
+Signed-off-by: Kamil Dudka <kdudka@redhat.com>
+---
+ lib/escape.c | 47 +++++++++++++++++++++++++++--------------------
+ 1 files changed, 27 insertions(+), 20 deletions(-)
+
+diff --git a/lib/escape.c b/lib/escape.c
+index e0e696a..868d56a 100644
+--- a/lib/escape.c
++++ b/lib/escape.c
+@@ -42,6 +42,30 @@
+ /* The last #include file should be: */
+ #include "memdebug.h"
+
++/* Portable character check (remember EBCDIC). Do not use isalnum() because
++its behavior is altered by the current locale. */
++static bool Curl_isalnum(unsigned char in)
++{
++ switch (in) {
++ case '0': case '1': case '2': case '3': case '4':
++ case '5': case '6': case '7': case '8': case '9':
++ case 'a': case 'b': case 'c': case 'd': case 'e':
++ case 'f': case 'g': case 'h': case 'i': case 'j':
++ case 'k': case 'l': case 'm': case 'n': case 'o':
++ case 'p': case 'q': case 'r': case 's': case 't':
++ case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
++ case 'A': case 'B': case 'C': case 'D': case 'E':
++ case 'F': case 'G': case 'H': case 'I': case 'J':
++ case 'K': case 'L': case 'M': case 'N': case 'O':
++ case 'P': case 'Q': case 'R': case 'S': case 'T':
++ case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':
++ return TRUE;
++ default:
++ break;
++ }
++ return FALSE;
++}
++
+ /* for ABI-compatibility with previous versions */
+ char *curl_escape(const char *string, int inlength)
+ {
+@@ -76,26 +100,10 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength)
+ while(length--) {
+ in = *string;
+
+- /* Portable character check (remember EBCDIC). Do not use isalnum() because
+- its behavior is altered by the current locale. */
+-
+- switch (in) {
+- case '0': case '1': case '2': case '3': case '4':
+- case '5': case '6': case '7': case '8': case '9':
+- case 'a': case 'b': case 'c': case 'd': case 'e':
+- case 'f': case 'g': case 'h': case 'i': case 'j':
+- case 'k': case 'l': case 'm': case 'n': case 'o':
+- case 'p': case 'q': case 'r': case 's': case 't':
+- case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
+- case 'A': case 'B': case 'C': case 'D': case 'E':
+- case 'F': case 'G': case 'H': case 'I': case 'J':
+- case 'K': case 'L': case 'M': case 'N': case 'O':
+- case 'P': case 'Q': case 'R': case 'S': case 'T':
+- case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':
++ if (Curl_isalnum(in)) {
+ /* just copy this */
+ ns[strindex++]=in;
+- break;
+- default:
++ } else {
+ /* encode it */
+ newlen += 2; /* the size grows with two, since this'll become a %XX */
+ if(newlen > alloc) {
+@@ -123,7 +131,6 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength)
+ snprintf(&ns[strindex], 4, "%%%02X", in);
+
+ strindex+=3;
+- break;
+ }
+ string++;
+ }
+@@ -191,7 +198,7 @@ char *curl_easy_unescape(CURL *handle, const char *string, int length,
+ }
+
+ /* For operating systems/environments that use different malloc/free
+- ssystems for the app and for this library, we provide a free that uses
++ systems for the app and for this library, we provide a free that uses
+ the library's memory system */
+ void curl_free(void *p)
+ {
+--
+1.7.1
+
+
+From 97aff30c56bde0d8a07ed3eadad5fa6b6bfd07eb Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <daniel@haxx.se>
+Date: Tue, 28 Sep 2010 23:46:14 +0200
+Subject: [PATCH 3/4] curl_easy_escape: don't escape "unreserved" characters
+
+According to RFC3986 section 2.3 the letters -, ., _ and ~ should not be
+percent-encoded.
+
+Reported by: Miguel Diaz
+Bug: http://curl.haxx.se/mail/lib-2010-09/0227.html
+
+[upstream commit 5df13c31735fa089d5344fde13b66ace1ea473d1]
+
+Signed-off-by: Kamil Dudka <kdudka@redhat.com>
+---
+ lib/escape.c | 9 ++++++---
+ tests/data/test58 | 2 +-
+ 2 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/lib/escape.c b/lib/escape.c
+index 868d56a..e759607 100644
+--- a/lib/escape.c
++++ b/lib/escape.c
+@@ -43,8 +43,10 @@
+ #include "memdebug.h"
+
+ /* Portable character check (remember EBCDIC). Do not use isalnum() because
+-its behavior is altered by the current locale. */
+-static bool Curl_isalnum(unsigned char in)
++ its behavior is altered by the current locale.
++ See http://tools.ietf.org/html/rfc3986#section-2.3
++*/
++static bool Curl_isunreserved(unsigned char in)
+ {
+ switch (in) {
+ case '0': case '1': case '2': case '3': case '4':
+@@ -59,6 +61,7 @@ static bool Curl_isalnum(unsigned char in)
+ case 'K': case 'L': case 'M': case 'N': case 'O':
+ case 'P': case 'Q': case 'R': case 'S': case 'T':
+ case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':
++ case '-': case '.': case '_': case '~':
+ return TRUE;
+ default:
+ break;
+@@ -100,7 +103,7 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength)
+ while(length--) {
+ in = *string;
+
+- if (Curl_isalnum(in)) {
++ if (Curl_isunreserved(in)) {
+ /* just copy this */
+ ns[strindex++]=in;
+ } else {
+diff --git a/tests/data/test58 b/tests/data/test58
+index 32d7731..7b85b0b 100644
+--- a/tests/data/test58
++++ b/tests/data/test58
+@@ -38,7 +38,7 @@ a few bytes
+ ^User-Agent:.*
+ </strip>
+ <protocol>
+-PUT /we/want/58te%5B%5Dst%2Etxt HTTP/1.1
++PUT /we/want/58te%5B%5Dst.txt HTTP/1.1
+ Host: 127.0.0.1:%HTTPPORT
+ Accept: */*
+ Content-Length: 12
+--
+1.7.1
+
+
+From a2ea27383a6028604540ce6f2e2f6bbc34bd7d5e Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <daniel@haxx.se>
+Date: Sun, 19 May 2013 23:24:29 +0200
+Subject: [PATCH 4/4] Curl_urldecode: no peaking beyond end of input buffer
+
+Security problem: CVE-2013-2174
+
+If a program would give a string like "%" to curl_easy_unescape(), it
+would still consider the % as start of an encoded character. The
+function then not only read beyond the buffer but it would also deduct
+the *unsigned* counter variable for how many more bytes there's left to
+read in the buffer by two, making the counter wrap. Continuing this, the
+function would go on reading beyond the buffer and soon writing beyond
+the allocated target buffer...
+
+Reported-by: Timo Sirainen
+
+Signed-off-by: Kamil Dudka <kdudka@redhat.com>
+---
+ lib/escape.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/lib/escape.c b/lib/escape.c
+index e759607..c891a22 100644
+--- a/lib/escape.c
++++ b/lib/escape.c
+@@ -163,7 +163,7 @@ char *curl_easy_unescape(CURL *handle, const char *string, int length,
+
+ while(--alloc > 0) {
+ in = *string;
+- if(('%' == in) && ishex(string[1]) && ishex(string[2])) {
++ if(('%' == in) && (alloc > 2) && ishex(string[1]) && ishex(string[2])) {
+ /* this is two hexadecimal digits following a '%' */
+ char hexstr[3];
+ char *ptr;
+--
+1.7.1
+