mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
packet: Add a bound check for nr_extensions
CID 1395335
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 461ebd1e2f)
This commit is contained in:
@@ -291,7 +291,13 @@ SSH_PACKET_CALLBACK(ssh_packet_ext_info)
|
||||
SSH_LOG(SSH_LOG_PACKET, "Failed to read number of extensions");
|
||||
return SSH_PACKET_USED;
|
||||
}
|
||||
|
||||
nr_extensions = ntohl(nr_extensions);
|
||||
if (nr_extensions > 128) {
|
||||
SSH_LOG(SSH_LOG_PACKET, "Invalid number of extensions");
|
||||
return SSH_PACKET_USED;
|
||||
}
|
||||
|
||||
SSH_LOG(SSH_LOG_PACKET, "Follows %u extensions", nr_extensions);
|
||||
|
||||
for (i = 0; i < nr_extensions; i++) {
|
||||
|
||||
Reference in New Issue
Block a user