diff options
| author | Sona Sarmadi <sona.sarmadi@enea.com> | 2016-11-15 10:08:16 +0100 |
|---|---|---|
| committer | Sona Sarmadi <sona.sarmadi@enea.com> | 2017-02-10 12:21:37 +0100 |
| commit | a4929f6e17d37f619cd279f14ae2ab828ae9e52e (patch) | |
| tree | f35090baabb5d141fc0327463945eb7fb08133b8 | |
| parent | 3b8cc15b749578c70ddd1a2bd2d18dea16f93c0d (diff) | |
| download | poky-a4929f6e17d37f619cd279f14ae2ab828ae9e52e.tar.gz | |
curl: CVE-2016-8621
curl_getdate read out of bounds
Affected versions: curl 7.12.2 to and including 7.50.3
Reference:
https://curl.haxx.se/docs/adv_20161102G.html
Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
| -rw-r--r-- | meta/recipes-support/curl/curl/CVE-2016-8621.patch | 120 | ||||
| -rw-r--r-- | meta/recipes-support/curl/curl_7.47.1.bb | 1 |
2 files changed, 121 insertions, 0 deletions
diff --git a/meta/recipes-support/curl/curl/CVE-2016-8621.patch b/meta/recipes-support/curl/curl/CVE-2016-8621.patch new file mode 100644 index 0000000000..7345838af7 --- /dev/null +++ b/meta/recipes-support/curl/curl/CVE-2016-8621.patch | |||
| @@ -0,0 +1,120 @@ | |||
| 1 | From 8a6d9ded5f02f0294ae63a007e26087316c1998e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Daniel Stenberg <daniel@haxx.se> | ||
| 3 | Date: Tue, 4 Oct 2016 16:59:38 +0200 | ||
| 4 | Subject: [PATCH] parsedate: handle cut off numbers better | ||
| 5 | |||
| 6 | ... and don't read outside of the given buffer! | ||
| 7 | |||
| 8 | CVE: CVE-2016-8621 | ||
| 9 | Upstream-Status: Backport | ||
| 10 | |||
| 11 | bug: https://curl.haxx.se/docs/adv_20161102G.html | ||
| 12 | Reported-by: Luật Nguyễn | ||
| 13 | Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com> | ||
| 14 | --- | ||
| 15 | lib/parsedate.c | 12 +++++++----- | ||
| 16 | tests/data/test517 | 6 ++++++ | ||
| 17 | tests/libtest/lib517.c | 8 +++++++- | ||
| 18 | 3 files changed, 20 insertions(+), 6 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/lib/parsedate.c b/lib/parsedate.c | ||
| 21 | index dfcf855..8e932f4 100644 | ||
| 22 | --- a/lib/parsedate.c | ||
| 23 | +++ b/lib/parsedate.c | ||
| 24 | @@ -3,11 +3,11 @@ | ||
| 25 | * Project ___| | | | _ \| | | ||
| 26 | * / __| | | | |_) | | | ||
| 27 | * | (__| |_| | _ <| |___ | ||
| 28 | * \___|\___/|_| \_\_____| | ||
| 29 | * | ||
| 30 | - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. | ||
| 31 | + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. | ||
| 32 | * | ||
| 33 | * This software is licensed as described in the file COPYING, which | ||
| 34 | * you should have received as part of this distribution. The terms | ||
| 35 | * are also available at https://curl.haxx.se/docs/copyright.html. | ||
| 36 | * | ||
| 37 | @@ -384,19 +384,21 @@ static int parsedate(const char *date, time_t *output) | ||
| 38 | } | ||
| 39 | else if(ISDIGIT(*date)) { | ||
| 40 | /* a digit */ | ||
| 41 | int val; | ||
| 42 | char *end; | ||
| 43 | + int len=0; | ||
| 44 | if((secnum == -1) && | ||
| 45 | - (3 == sscanf(date, "%02d:%02d:%02d", &hournum, &minnum, &secnum))) { | ||
| 46 | + (3 == sscanf(date, "%02d:%02d:%02d%n", | ||
| 47 | + &hournum, &minnum, &secnum, &len))) { | ||
| 48 | /* time stamp! */ | ||
| 49 | - date += 8; | ||
| 50 | + date += len; | ||
| 51 | } | ||
| 52 | else if((secnum == -1) && | ||
| 53 | - (2 == sscanf(date, "%02d:%02d", &hournum, &minnum))) { | ||
| 54 | + (2 == sscanf(date, "%02d:%02d%n", &hournum, &minnum, &len))) { | ||
| 55 | /* time stamp without seconds */ | ||
| 56 | - date += 5; | ||
| 57 | + date += len; | ||
| 58 | secnum = 0; | ||
| 59 | } | ||
| 60 | else { | ||
| 61 | long lval; | ||
| 62 | int error; | ||
| 63 | diff --git a/tests/data/test517 b/tests/data/test517 | ||
| 64 | index c81a45e..513634f 100644 | ||
| 65 | --- a/tests/data/test517 | ||
| 66 | +++ b/tests/data/test517 | ||
| 67 | @@ -114,10 +114,16 @@ nothing | ||
| 68 | 79: 20110632 12:34:56 => -1 | ||
| 69 | 80: 20110623 56:34:56 => -1 | ||
| 70 | 81: 20111323 12:34:56 => -1 | ||
| 71 | 82: 20110623 12:34:79 => -1 | ||
| 72 | 83: Wed, 31 Dec 2008 23:59:60 GMT => 1230768000 | ||
| 73 | +84: 20110623 12:3 => 1308830580 | ||
| 74 | +85: 20110623 1:3 => 1308790980 | ||
| 75 | +86: 20110623 1:30 => 1308792600 | ||
| 76 | +87: 20110623 12:12:3 => 1308831123 | ||
| 77 | +88: 20110623 01:12:3 => 1308791523 | ||
| 78 | +89: 20110623 01:99:30 => -1 | ||
| 79 | </stdout> | ||
| 80 | |||
| 81 | # This test case previously tested an overflow case ("2094 Nov 6 => | ||
| 82 | # 2147483647") for 32bit time_t, but since some systems have 64bit time_t and | ||
| 83 | # handles this (returning 3939840000), and some 64bit-time_t systems don't | ||
| 84 | diff --git a/tests/libtest/lib517.c b/tests/libtest/lib517.c | ||
| 85 | index 2f68ebd..22162ff 100644 | ||
| 86 | --- a/tests/libtest/lib517.c | ||
| 87 | +++ b/tests/libtest/lib517.c | ||
| 88 | @@ -3,11 +3,11 @@ | ||
| 89 | * Project ___| | | | _ \| | | ||
| 90 | * / __| | | | |_) | | | ||
| 91 | * | (__| |_| | _ <| |___ | ||
| 92 | * \___|\___/|_| \_\_____| | ||
| 93 | * | ||
| 94 | - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. | ||
| 95 | + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. | ||
| 96 | * | ||
| 97 | * This software is licensed as described in the file COPYING, which | ||
| 98 | * you should have received as part of this distribution. The terms | ||
| 99 | * are also available at https://curl.haxx.se/docs/copyright.html. | ||
| 100 | * | ||
| 101 | @@ -114,10 +114,16 @@ static const char * const dates[]={ | ||
| 102 | "20110632 12:34:56", | ||
| 103 | "20110623 56:34:56", | ||
| 104 | "20111323 12:34:56", | ||
| 105 | "20110623 12:34:79", | ||
| 106 | "Wed, 31 Dec 2008 23:59:60 GMT", /* leap second */ | ||
| 107 | + "20110623 12:3", | ||
| 108 | + "20110623 1:3", | ||
| 109 | + "20110623 1:30", | ||
| 110 | + "20110623 12:12:3", | ||
| 111 | + "20110623 01:12:3", | ||
| 112 | + "20110623 01:99:30", | ||
| 113 | NULL | ||
| 114 | }; | ||
| 115 | |||
| 116 | int test(char *URL) | ||
| 117 | { | ||
| 118 | -- | ||
| 119 | 2.9.3 | ||
| 120 | |||
diff --git a/meta/recipes-support/curl/curl_7.47.1.bb b/meta/recipes-support/curl/curl_7.47.1.bb index e6ad03f44a..67b07da8d8 100644 --- a/meta/recipes-support/curl/curl_7.47.1.bb +++ b/meta/recipes-support/curl/curl_7.47.1.bb | |||
| @@ -21,6 +21,7 @@ SRC_URI += " file://configure_ac.patch \ | |||
| 21 | file://CVE-2016-8618.patch \ | 21 | file://CVE-2016-8618.patch \ |
| 22 | file://CVE-2016-8619.patch \ | 22 | file://CVE-2016-8619.patch \ |
| 23 | file://CVE-2016-8620.patch \ | 23 | file://CVE-2016-8620.patch \ |
| 24 | file://CVE-2016-8621.patch \ | ||
| 24 | " | 25 | " |
| 25 | 26 | ||
| 26 | SRC_URI[md5sum] = "9ea3123449439bbd960cd25cf98796fb" | 27 | SRC_URI[md5sum] = "9ea3123449439bbd960cd25cf98796fb" |
