summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/curl/curl/CVE-2019-5482.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/curl/curl/CVE-2019-5482.patch')
-rw-r--r--meta/recipes-support/curl/curl/CVE-2019-5482.patch68
1 files changed, 68 insertions, 0 deletions
diff --git a/meta/recipes-support/curl/curl/CVE-2019-5482.patch b/meta/recipes-support/curl/curl/CVE-2019-5482.patch
new file mode 100644
index 0000000000..91b186699d
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2019-5482.patch
@@ -0,0 +1,68 @@
1From 38319e0717844c32464a6c7630de9be226f1c6f4 Mon Sep 17 00:00:00 2001
2From: Thomas Vegas <>
3Date: Sat, 31 Aug 2019 17:30:51 +0200
4Subject: [PATCH] tftp: Alloc maximum blksize, and use default unless OACK is
5 received
6Reply-To: muislam@microsoft.com
7
8Fixes potential buffer overflow from 'recvfrom()', should the server
9return an OACK without blksize.
10
11Bug: https://curl.haxx.se/docs/CVE-2019-5482.html
12
13CVE: CVE-2019-5482
14
15Upstream-Status: Backport
16
17Signed-off-by: Muminul Islam <muislam@microsoft.com>
18---
19 lib/tftp.c | 12 +++++++++---
20 1 file changed, 9 insertions(+), 3 deletions(-)
21
22diff --git a/lib/tftp.c b/lib/tftp.c
23index 064eef318..2c148e3e1 100644
24--- a/lib/tftp.c
25+++ b/lib/tftp.c
26@@ -969,6 +969,7 @@ static CURLcode tftp_connect(struct connectdata *conn, bool *done)
27 {
28 tftp_state_data_t *state;
29 int blksize;
30+ int need_blksize;
31
32 blksize = TFTP_BLKSIZE_DEFAULT;
33
34@@ -983,15 +984,20 @@ static CURLcode tftp_connect(struct connectdata *conn, bool *done)
35 return CURLE_TFTP_ILLEGAL;
36 }
37
38+ need_blksize = blksize;
39+ /* default size is the fallback when no OACK is received */
40+ if(need_blksize < TFTP_BLKSIZE_DEFAULT)
41+ need_blksize = TFTP_BLKSIZE_DEFAULT;
42+
43 if(!state->rpacket.data) {
44- state->rpacket.data = calloc(1, blksize + 2 + 2);
45+ state->rpacket.data = calloc(1, need_blksize + 2 + 2);
46
47 if(!state->rpacket.data)
48 return CURLE_OUT_OF_MEMORY;
49 }
50
51 if(!state->spacket.data) {
52- state->spacket.data = calloc(1, blksize + 2 + 2);
53+ state->spacket.data = calloc(1, need_blksize + 2 + 2);
54
55 if(!state->spacket.data)
56 return CURLE_OUT_OF_MEMORY;
57@@ -1005,7 +1011,7 @@ static CURLcode tftp_connect(struct connectdata *conn, bool *done)
58 state->sockfd = state->conn->sock[FIRSTSOCKET];
59 state->state = TFTP_STATE_START;
60 state->error = TFTP_ERR_NONE;
61- state->blksize = blksize;
62+ state->blksize = TFTP_BLKSIZE_DEFAULT; /* Unless updated by OACK response */
63 state->requested_blksize = blksize;
64
65 ((struct sockaddr *)&state->local_addr)->sa_family =
66--
672.23.0
68