Applied Francois Dupoux's extra checks for weird packet or padding length in
incoming packets. We really need to bail out this way on weird input. bug report #2814613
This commit is contained in:
parent
bea1beb4fd
commit
acbdbb8914
@ -431,7 +431,12 @@ _libssh2_transport_read(LIBSSH2_SESSION * session)
|
|||||||
* and we can extract packet and padding length from it
|
* and we can extract packet and padding length from it
|
||||||
*/
|
*/
|
||||||
p->packet_length = _libssh2_ntohu32(block);
|
p->packet_length = _libssh2_ntohu32(block);
|
||||||
|
if ((p->packet_length < 1) || (p->packet_length > PACKETBUFSIZE))
|
||||||
|
return PACKET_FAIL;
|
||||||
|
|
||||||
p->padding_length = block[4];
|
p->padding_length = block[4];
|
||||||
|
if (p->padding_length < 0)
|
||||||
|
return PACKET_FAIL;
|
||||||
|
|
||||||
/* total_num is the number of bytes following the initial
|
/* total_num is the number of bytes following the initial
|
||||||
(5 bytes) packet length and padding length fields */
|
(5 bytes) packet length and padding length fields */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user