diff mbox series

[wrynose,07/12] curl: fix CVE-2026-107928

Message ID 20261104073627.302002-8-dkelaiya@cisco.com
State New
Headers show
Series curl: Security fixes | expand

Commit Message

From: Darsh Kelaiya <dkelaiya@cisco.com>

This patch applies the upstream fix as referenced in [2],
using the commit shown in [1].

Reject a GnuTLS send result larger than the supplied buffer before
advancing the buffer pointer or subtracting the remaining length.
The advisory's trigger requires GnuTLS and WebSockets.

[1] https://github.com/curl/curl/commit/64fb3e7a7b116f690966054f281624152d4a7651
[2] https://curl.se/docs/CVE-2026-107928.html

Signed-off-by: Darsh Kelaiya <dkelaiya@cisco.com>
---
 .../curl/curl/CVE-2026-107928.patch           | 40 +++++++++++++++++++
 meta/recipes-support/curl/curl_8.19.0.bb      |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 meta/recipes-support/curl/curl/CVE-2026-107928.patch
diff mbox series

Patch

diff --git a/meta/recipes-support/curl/curl/CVE-2026-107928.patch b/meta/recipes-support/curl/curl/CVE-2026-107928.patch
new file mode 100644
index 00000000000..67f66f097ca
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2026-107928.patch
@@ -0,0 +1,40 @@ 
+From 64fb3e7a7b116f690966054f281624152d4a7651 Mon Sep 17 00:00:00 2001
+From: Stefan Eissing <stefan@eissing.org>
+Date: Wed, 7 Oct 2026 11:22:39 +0200
+Subject: [PATCH] gnutls: hardening
+
+Check the result code of `gnutls_record_send()` for sanity also in
+production builds.
+
+Closes #23297
+
+CVE: CVE-2026-107928
+Upstream-Status: Backport [https://github.com/curl/curl/commit/64fb3e7a7b116f690966054f281624152d4a7651]
+
+(cherry picked from commit 64fb3e7a7b116f690966054f281624152d4a7651)
+Signed-off-by: Darsh Kelaiya <dkelaiya@cisco.com>
+---
+ lib/vtls/gtls.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
+index f19940a..b87b27d 100644
+--- a/lib/vtls/gtls.c
++++ b/lib/vtls/gtls.c
+@@ -2064,8 +2064,13 @@ static CURLcode gtls_send(struct Curl_cfilter *cf,
+     nwritten = gnutls_record_send(backend->gtls.session, buf, remain);
+ 
+     if(nwritten >= 0) {
++      if((size_t)nwritten > remain) {
++        DEBUGASSERT(0);
++        failf(data, "gnutls_record_send(len=%zu) returned %zd",
++              remain, nwritten);
++        return CURLE_SEND_ERROR;
++      }
+       *pnwritten += (size_t)nwritten;
+-      DEBUGASSERT((size_t)nwritten <= remain);
+       buf = (char *)CURL_UNCONST(buf) + (size_t)nwritten;
+       remain -= (size_t)nwritten;
+     }
+-- 
+2.35.6
diff --git a/meta/recipes-support/curl/curl_8.19.0.bb b/meta/recipes-support/curl/curl_8.19.0.bb
index 3e804a26f3a..9a85d470dc5 100644
--- a/meta/recipes-support/curl/curl_8.19.0.bb
+++ b/meta/recipes-support/curl/curl_8.19.0.bb
@@ -55,6 +55,7 @@  SRC_URI = "https://curl.se/download/${BP}.tar.xz \
            file://CVE-2026-86412.patch \
            file://CVE-2026-92386_p1.patch \
            file://CVE-2026-92386_p2.patch \
+           file://CVE-2026-107928.patch \
            "
 
 SRC_URI:append:class-nativesdk = " \