From f80670a7aba86cbb442c9b115c9eaf4ca04601b8 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Thu, 11 Dec 2025 13:22:44 +0100 Subject: [PATCH] sftp: Fix out-of-bound read from sftp extensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub Jelen Reviewed-by: Pavol Žáčik (cherry picked from commit 855a0853ad3abd4a6cd85ce06fce6d8d4c7a0b60) --- src/sftp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sftp.c b/src/sftp.c index c9f82912..d1290123 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -587,7 +587,7 @@ const char *sftp_extensions_get_name(sftp_session sftp, unsigned int idx) return NULL; } - if (idx > sftp->ext->count) { + if (idx >= sftp->ext->count) { ssh_set_error_invalid(sftp->session); return NULL; } @@ -606,7 +606,7 @@ const char *sftp_extensions_get_data(sftp_session sftp, unsigned int idx) return NULL; } - if (idx > sftp->ext->count) { + if (idx >= sftp->ext->count) { ssh_set_error_invalid(sftp->session); return NULL; }