1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

packet: Add a bound check for nr_extensions

CID 1395335

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider
2018-09-01 09:26:37 +02:00
parent be147e897d
commit 461ebd1e2f

View File

@@ -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++) {