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

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

View File

@@ -603,7 +603,7 @@ const char *sftp_extensions_get_name(sftp_session sftp, unsigned int idx)
return NULL; return NULL;
} }
if (idx > sftp->ext->count) { if (idx >= sftp->ext->count) {
ssh_set_error_invalid(sftp->session); ssh_set_error_invalid(sftp->session);
return NULL; return NULL;
} }
@@ -622,7 +622,7 @@ const char *sftp_extensions_get_data(sftp_session sftp, unsigned int idx)
return NULL; return NULL;
} }
if (idx > sftp->ext->count) { if (idx >= sftp->ext->count) {
ssh_set_error_invalid(sftp->session); ssh_set_error_invalid(sftp->session);
return NULL; return NULL;
} }