summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/curl/curl/CVE-2019-3823.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/curl/curl/CVE-2019-3823.patch')
-rw-r--r--meta/recipes-support/curl/curl/CVE-2019-3823.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/meta/recipes-support/curl/curl/CVE-2019-3823.patch b/meta/recipes-support/curl/curl/CVE-2019-3823.patch
new file mode 100644
index 0000000000..194e6e6430
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2019-3823.patch
@@ -0,0 +1,55 @@
1From 40f6c913f63cdbfa81daa7ac7f1c7415bb99edeb Mon Sep 17 00:00:00 2001
2From: Daniel Gustafsson <daniel@yesql.se>
3Date: Sat, 19 Jan 2019 00:42:47 +0100
4Subject: [PATCH 3/3] smtp: avoid risk of buffer overflow in strtol
5
6If the incoming len 5, but the buffer does not have a termination
7after 5 bytes, the strtol() call may keep reading through the line
8buffer until is exceeds its boundary. Fix by ensuring that we are
9using a bounded read with a temporary buffer on the stack.
10
11Bug: https://curl.haxx.se/docs/CVE-2019-3823.html
12Reported-by: Brian Carpenter (Geeknik Labs)
13CVE-2019-3823
14
15Upstream-Status: Backport
16[https://github.com/curl/curl/commit
17/39df4073e5413fcdbb5a38da0c1ce6f1c0ceb484]
18
19CVE: CVE-2019-3823
20
21Signed-off-by: Kevin Weng <t-keweng@microsoft.com>
22---
23 lib/smtp.c | 8 ++++++--
24 1 file changed, 6 insertions(+), 2 deletions(-)
25
26diff --git a/lib/smtp.c b/lib/smtp.c
27index ecf10a41a..1b9f92d30 100644
28--- a/lib/smtp.c
29+++ b/lib/smtp.c
30@@ -5,7 +5,7 @@
31 * | (__| |_| | _ <| |___
32 * \___|\___/|_| \_\_____|
33 *
34- * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
35+ * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
36 *
37 * This software is licensed as described in the file COPYING, which
38 * you should have received as part of this distribution. The terms
39@@ -207,8 +207,12 @@ static bool smtp_endofresp(struct connectdata *conn, char *line, size_t len,
40 Section 4. Examples of RFC-4954 but some e-mail servers ignore this and
41 only send the response code instead as per Section 4.2. */
42 if(line[3] == ' ' || len == 5) {
43+ char tmpline[6];
44+
45 result = TRUE;
46- *resp = curlx_sltosi(strtol(line, NULL, 10));
47+ memset(tmpline, '\0', sizeof(tmpline));
48+ memcpy(tmpline, line, (len == 5 ? 5 : 3));
49+ *resp = curlx_sltosi(strtol(tmpline, NULL, 10));
50
51 /* Make sure real server never sends internal value */
52 if(*resp == 1)
53--
542.22.0
55