From c197d93a92888b28527499e38839bc0f3c351f76 Mon Sep 17 00:00:00 2001 From: Leonardo Arena Date: Mon, 23 Oct 2017 13:16:02 +0000 Subject: main/curl: security fix (CVE-2017-1000254) fixes #7965 --- main/curl/APKBUILD | 14 ++++++++-- main/curl/CVE-2017-1000254.patch | 58 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 main/curl/CVE-2017-1000254.patch diff --git a/main/curl/APKBUILD b/main/curl/APKBUILD index 20ff1cf0b97..67276203325 100644 --- a/main/curl/APKBUILD +++ b/main/curl/APKBUILD @@ -3,7 +3,7 @@ # Maintainer: Natanael Copa pkgname=curl pkgver=7.55.0 -pkgrel=0 +pkgrel=1 pkgdesc="An URL retrival utility and library" url="http://curl.haxx.se" arch="all" @@ -14,11 +14,14 @@ makedepends="groff $depends_dev perl" subpackages="$pkgname-doc $pkgname-dev" source="http://curl.haxx.se/download/curl-$pkgver.tar.bz2 curl-do-bounds-check-using-a-double-comparison.patch + CVE-2017-1000254.patch " _builddir="$srcdir/$pkgname-$pkgver" # secfixes: +# 7.55.0-r1: +# - CVE-2017-1000254 # 7.55.0-r0: # - CVE-2017-1000099 # - CVE-2017-1000100 @@ -86,5 +89,12 @@ package() { make DESTDIR="$pkgdir" install || return 1 } +md5sums="90cd4d6b20fa7655d2b75efe09fd7bfe curl-7.55.0.tar.bz2 +feda61a45b36819f4fd5c7a6fadeaf8c curl-do-bounds-check-using-a-double-comparison.patch +2e67e36a5b8582ce5fed4e56811aa55e CVE-2017-1000254.patch" +sha256sums="af1d69ec6f15fe70a2cabaa98309732bf035ef2a735e4e1a3e08754d2780e5b1 curl-7.55.0.tar.bz2 +de1bc7dfc6bad0f67743e4a0e5707458e7607cbacf61de51eaeb597cd07710d7 curl-do-bounds-check-using-a-double-comparison.patch +b6c62ea72cd02e7d35280fad8b77007be4f8527debd1f8a6b201a8b00ed1359c CVE-2017-1000254.patch" sha512sums="4975864621219e937585aaf5a9a54bba112b58bbf5a8acd92e1e972ea747a15a5564143548c5d8930b8c0d0e9d27d28225d0c81e52a1ba71e4c6f9e3859c978b curl-7.55.0.tar.bz2 -d0f102fdbc2174169b2fea9248c3187d8c546d3a788447769dceec5fb7e063adbebbc967b88d208af1355cfda600f837abdae6d2e057a096eededc1857d2b8d3 curl-do-bounds-check-using-a-double-comparison.patch" +d0f102fdbc2174169b2fea9248c3187d8c546d3a788447769dceec5fb7e063adbebbc967b88d208af1355cfda600f837abdae6d2e057a096eededc1857d2b8d3 curl-do-bounds-check-using-a-double-comparison.patch +9ffb77d823eed786ed2dc03ab01948761e754ed74be3dde8d8fac7f3ec77f997826f5908a45d042c359d16d2ce300612ea694f89f46c995825733272ae7d0326 CVE-2017-1000254.patch" diff --git a/main/curl/CVE-2017-1000254.patch b/main/curl/CVE-2017-1000254.patch new file mode 100644 index 00000000000..2f1a16fd160 --- /dev/null +++ b/main/curl/CVE-2017-1000254.patch @@ -0,0 +1,58 @@ +From 29b251362e1839d7094993edbed8f9467069773f Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg +Date: Mon, 25 Sep 2017 00:35:22 +0200 +Subject: [PATCH] FTP: zero terminate the entry path even on bad input + +... a single double quote could leave the entry path buffer without a zero +terminating byte. CVE-2017-1000254 + +Test 1152 added to verify. + +Reported-by: Max Dymond +Bug: https://curl.haxx.se/docs/adv_20171004.html +--- + lib/ftp.c | 7 ++++-- + 3 files changed, 67 insertions(+), 2 deletions(-) + create mode 100644 tests/data/test1152 + +diff --git a/lib/ftp.c b/lib/ftp.c +index 4860509f3..54ba4057f 100644 +--- a/lib/ftp.c ++++ b/lib/ftp.c +@@ -2777,10 +2777,11 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) + if(ftpcode == 257) { + char *ptr = &data->state.buffer[4]; /* start on the first letter */ + const size_t buf_size = data->set.buffer_size; + char *dir; + char *store; ++ bool entry_extracted = FALSE; + + dir = malloc(nread + 1); + if(!dir) + return CURLE_OUT_OF_MEMORY; + +@@ -2808,20 +2809,22 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) + *store = ptr[1]; + ptr++; + } + else { + /* end of path */ +- *store = '\0'; /* zero terminate */ ++ entry_extracted = TRUE; + break; /* get out of this loop */ + } + } + else + *store = *ptr; + store++; + ptr++; + } +- ++ *store = '\0'; /* zero terminate */ ++ } ++ if(entry_extracted) { + /* If the path name does not look like an absolute path (i.e.: it + does not start with a '/'), we probably need some server-dependent + adjustments. For example, this is the case when connecting to + an OS400 FTP server: this server supports two name syntaxes, + the default one being incompatible with standard paths. In -- cgit v1.2.3