sftp: Fix out-of-bound read from sftp extensions

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit 855a0853ad)
This commit is contained in:
Jakub Jelen
2025-12-11 13:22:44 +01:00
parent 829fae6404
commit f80670a7ab

View File

@@ -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;
}