diff --git a/backport-0020-CVE-2025-5318-fix-possible-buffer-overrun.patch b/backport-0020-CVE-2025-5318-fix-possible-buffer-overrun.patch new file mode 100644 index 0000000000000000000000000000000000000000..745e7979c8e5bcac26c42242981563f2abc489c8 --- /dev/null +++ b/backport-0020-CVE-2025-5318-fix-possible-buffer-overrun.patch @@ -0,0 +1,30 @@ +From ae8881dfe54214c0c0eb88345c35e15a14081b3d Mon Sep 17 00:00:00 2001 +From: Jakub Jelen +Date: Tue, 22 Apr 2025 21:18:44 +0200 +Subject: CVE-2025-5318: sftpserver: Fix possible buffer overrun + +Signed-off-by: Jakub Jelen +Reviewed-by: Andreas Schneider + +Conflict: NA +Reference:https://git.libssh.org/projects/libssh.git/patch/?id=ae8881dfe54214c0c0eb88345c35e15a14081b3d +--- + src/sftpserver.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sftpserver.c b/src/sftpserver.c +index 9117f15..b3349e1 100644 +--- a/src/sftpserver.c ++++ b/src/sftpserver.c +@@ -538,7 +538,7 @@ void *sftp_handle(sftp_session sftp, ssh_string handle){ + + memcpy(&val, ssh_string_data(handle), sizeof(uint32_t)); + +- if (val > SFTP_HANDLES) { ++ if (val >= SFTP_HANDLES) { + return NULL; + } + +-- +2.33.0 + diff --git a/libssh.spec b/libssh.spec index 720d1cdbfae2cdd9e7e9a77a21a895387ed82f42..3ef4211224801b8ec39eec08edcd93fd6c863cbe 100644 --- a/libssh.spec +++ b/libssh.spec @@ -1,6 +1,6 @@ Name: libssh Version: 0.10.5 -Release: 3 +Release: 4 Summary: A library implementing the SSH protocol License: LGPLv2+ URL: http://www.libssh.org @@ -29,6 +29,7 @@ Patch17: backport-0017-CVE-2023-6918-Systematically-check-return-values-w Patch18: backport-0018-CVE-2023-6918-kdf-Detect-context-init-failures.patch Patch19: backport-0019-CVE-2023-6918-tests-Code-coverage-for-ssh_get_pubkey.patch Patch20: backport-Fix-regression-in-IPv6-addresses-in-hostname-parsing.patch +Patch21: backport-0020-CVE-2025-5318-fix-possible-buffer-overrun.patch BuildRequires: cmake gcc-c++ gnupg2 openssl-devel pkgconfig zlib-devel BuildRequires: krb5-devel libcmocka-devel openssh-clients openssh-server @@ -114,6 +115,12 @@ popd %doc CHANGELOG README %changelog +* Wed Jul 2 2025 zhangbinqin - 0.10.5-4 +- Type:CVE +- Id:CVE-2025-5318 +- SUG:NA +- DESC:fix CVE-2025-5318 + * Tue Oct 29 2024 bitianyuan - 0.10.5-3 - Type:bugfix - Id:NA