mirror of
https://git.yoctoproject.org/poky
synced 2026-10-15 04:57:15 +00:00
wget: Fix CVE-2026-58470
This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. It also includes the upstream regression patch from commit shown in [3] which changes all three Content-Range conversions to strtoll(). [1] https://gitlab.com/gnuwget/wget/-/commit/43d3ba9336bc94937e6fae2365c6ffd30c34ffcf [2] https://nvd.nist.gov/vuln/detail/CVE-2026-58470 [3] https://gitlab.com/gnuwget/wget/-/commit/01ff771caac1958662ca8665eed2021ec386a7af (From OE-Core rev: ee6588c4285e10d0784421b1c77bab09c1638aa1) Signed-off-by: Hetvi Thakar <hthakar@cisco.com> Signed-off-by: Yoann Congal <yoann.congal@smile.fr> Signed-off-by: Paul Barker <paul@pbarker.dev>
This commit is contained in:
1 parent
79af1381a9
commit
af54b815cd
3 files changed
+129
No files matched your search
@@ -0,0 +1,48 @@
|
||||
From 01ff771caac1958662ca8665eed2021ec386a7af Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
|
||||
Date: Wed, 12 Aug 2026 19:45:21 +0200
|
||||
Subject: [PATCH] * src/http.c (parse_content_range): Use strtoll instead of
|
||||
strtol.
|
||||
|
||||
CVE: CVE-2026-58470
|
||||
Upstream-Status: Backport [https://gitlab.com/gnuwget/wget/-/commit/01ff771caac1958662ca8665eed2021ec386a7af]
|
||||
|
||||
(cherry picked from commit 01ff771caac1958662ca8665eed2021ec386a7af)
|
||||
Signed-off-by: Hetvi Thakar <hthakar@cisco.com>
|
||||
---
|
||||
src/http.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/http.c b/src/http.c
|
||||
index e5e75ee695..8170a43c27 100644
|
||||
--- a/src/http.c
|
||||
+++ b/src/http.c
|
||||
@@ -949,7 +949,7 @@ parse_content_range (const char *hdr, wgint *first_byte_ptr,
|
||||
return false;
|
||||
|
||||
errno = 0;
|
||||
- num = strtol(hdr, &end, 10);
|
||||
+ num = strtoll(hdr, &end, 10);
|
||||
if (errno == ERANGE)
|
||||
return false;
|
||||
hdr = end;
|
||||
@@ -959,7 +959,7 @@ parse_content_range (const char *hdr, wgint *first_byte_ptr,
|
||||
*first_byte_ptr = num;
|
||||
|
||||
errno = 0;
|
||||
- num = strtol(hdr, &end, 10);
|
||||
+ num = strtoll(hdr, &end, 10);
|
||||
if (errno == ERANGE)
|
||||
return false;
|
||||
hdr = end;
|
||||
@@ -976,7 +976,7 @@ parse_content_range (const char *hdr, wgint *first_byte_ptr,
|
||||
else
|
||||
{
|
||||
errno = 0;
|
||||
- num = strtol(hdr, NULL, 10);
|
||||
+ num = strtoll(hdr, NULL, 10);
|
||||
if (errno == ERANGE)
|
||||
return false;
|
||||
}
|
||||
--
|
||||
2.35.6
|
||||
@@ -0,0 +1,79 @@
|
||||
From bfbab29e0a94160b283a8101e122d07684104955 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
|
||||
Date: Mon, 29 Jun 2026 18:57:54 +0200
|
||||
Subject: [PATCH] * src/http.c (parse_content_range): Fix integer overflow
|
||||
|
||||
Reported-by: TristanInSec@gmail.com
|
||||
|
||||
CVE: CVE-2026-58470
|
||||
Upstream-Status: Backport [https://gitlab.com/gnuwget/wget/-/commit/43d3ba9336bc94937e6fae2365c6ffd30c34ffcf]
|
||||
|
||||
(cherry picked from commit 43d3ba9336bc94937e6fae2365c6ffd30c34ffcf)
|
||||
Signed-off-by: Hetvi Thakar <hthakar@cisco.com>
|
||||
---
|
||||
src/http.c | 35 ++++++++++++++++++++++++-----------
|
||||
1 file changed, 24 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/src/http.c b/src/http.c
|
||||
index 116a93a3..4dc6b70f 100644
|
||||
--- a/src/http.c
|
||||
+++ b/src/http.c
|
||||
@@ -914,6 +914,7 @@ parse_content_range (const char *hdr, wgint *first_byte_ptr,
|
||||
wgint *last_byte_ptr, wgint *entity_length_ptr)
|
||||
{
|
||||
wgint num;
|
||||
+ char *end;
|
||||
|
||||
/* Ancient versions of Netscape proxy server, presumably predating
|
||||
rfc2068, sent out `Content-Range' without the "bytes"
|
||||
@@ -932,27 +933,39 @@ parse_content_range (const char *hdr, wgint *first_byte_ptr,
|
||||
}
|
||||
if (!c_isdigit (*hdr))
|
||||
return false;
|
||||
- for (num = 0; c_isdigit (*hdr); hdr++)
|
||||
- num = 10 * num + (*hdr - '0');
|
||||
- if (*hdr != '-' || !c_isdigit (*(hdr + 1)))
|
||||
+
|
||||
+ errno = 0;
|
||||
+ num = strtol(hdr, &end, 10);
|
||||
+ if (errno == ERANGE)
|
||||
+ return false;
|
||||
+ hdr = end;
|
||||
+
|
||||
+ if (*hdr++ != '-' || !c_isdigit (*hdr))
|
||||
return false;
|
||||
*first_byte_ptr = num;
|
||||
- ++hdr;
|
||||
- for (num = 0; c_isdigit (*hdr); hdr++)
|
||||
- num = 10 * num + (*hdr - '0');
|
||||
- if (*hdr != '/')
|
||||
+
|
||||
+ errno = 0;
|
||||
+ num = strtol(hdr, &end, 10);
|
||||
+ if (errno == ERANGE)
|
||||
+ return false;
|
||||
+ hdr = end;
|
||||
+
|
||||
+ if (*hdr++ != '/')
|
||||
return false;
|
||||
*last_byte_ptr = num;
|
||||
- if (!(c_isdigit (*(hdr + 1)) || *(hdr + 1) == '*'))
|
||||
+ if (!(c_isdigit (*hdr) || *hdr == '*'))
|
||||
return false;
|
||||
if (*last_byte_ptr < *first_byte_ptr)
|
||||
return false;
|
||||
- ++hdr;
|
||||
if (*hdr == '*')
|
||||
num = -1;
|
||||
else
|
||||
- for (num = 0; c_isdigit (*hdr); hdr++)
|
||||
- num = 10 * num + (*hdr - '0');
|
||||
+ {
|
||||
+ errno = 0;
|
||||
+ num = strtol(hdr, NULL, 10);
|
||||
+ if (errno == ERANGE)
|
||||
+ return false;
|
||||
+ }
|
||||
*entity_length_ptr = num;
|
||||
if ((*entity_length_ptr <= *last_byte_ptr) && *entity_length_ptr != -1)
|
||||
return false;
|
||||
@@ -8,6 +8,8 @@ SRC_URI = "${GNU_MIRROR}/wget/wget-${PV}.tar.gz \
|
||||
file://CVE-2026-58471.patch \
|
||||
file://CVE-2026-58472.patch \
|
||||
file://CVE-2026-58472-regression.patch \
|
||||
file://CVE-2026-58470.patch \
|
||||
file://CVE-2026-58470-regression.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "81542f5cefb8faacc39bbbc6c82ded80e3e4a88505ae72ea51df27525bcde04c"
|
||||
|
||||
Reference in new issue
Block a user