libssh2: fix CVE-2026-66032

Reference:
https://nvd.nist.gov/vuln/detail/CVE-2026-66032
5e47761465

libssh2 ptest results (qemux86-64):
  before: PASSED: 1 FAILED: 0 SKIPPED: 0
  after:  PASSED: 1 FAILED: 0 SKIPPED: 0

(From OE-Core rev: c578c63b01b919bc403b9fb27bd76a2ccc632d3c)

Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
Signed-off-by: Fabien Thomas <fabien.thomas@smile.fr>
Signed-off-by: Paul Barker <paul@pbarker.dev>
This commit is contained in:
Jaipaul Cheernam
2026-08-04 15:09:43 +02:00
committed by Paul Barker
parent 0656d53a6b
commit 23aeeb9e5d
2 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
From 352341aaebcf91ab16e7fcff158fef4a3b8c32f6 Mon Sep 17 00:00:00 2001
From: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
Date: Tue, 4 Aug 2026 12:32:31 +0000
Subject: [PATCH] Prevent dangling pointer by nullifying data (#2180)
Set data to NULL after freeing it to avoid dangling pointer. fixes
GHSA-px3w-7g75-hg7w.
Credit: VladimirEliTokarev
CVE: CVE-2026-66032
Upstream-Status: Backport [https://github.com/libssh2/libssh2/commit/5e4776146552d898b9c0e1b313cd093fa8dc92d0]
Backport adaptations:
- The upstream fix uses SSH2_FREE() which was renamed from
LIBSSH2_FREE() in newer libssh2. Context adjusted to match
the 1.11.1 codebase (different line numbers and surrounding
function/macro names).
Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
---
src/sftp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/sftp.c b/src/sftp.c
index 6ede3111..793f267c 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -1279,6 +1279,7 @@ sftp_open(LIBSSH2_SFTP *sftp, const char *filename,
"got HANDLE FXOK"));
LIBSSH2_FREE(session, data);
+ data = NULL;
/* silly situation, but check for a HANDLE */
rc = sftp_packet_require(sftp, SSH_FXP_HANDLE,

View File

@@ -16,6 +16,7 @@ SRC_URI = "http://www.libssh2.org/download/${BP}.tar.gz \
file://CVE-2025-15661-1.patch \
file://CVE-2025-15661-2.patch \
file://CVE-2025-15661-3.patch \
file://CVE-2026-66032.patch \
"
SRC_URI[sha256sum] = "d9ec76cbe34db98eec3539fe2c899d26b0c837cb3eb466a56b0f109cabf658f7"