mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-27 13:21:11 +03:00
sftp: Add bound check for size
CID: #1238630 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
@@ -353,7 +354,7 @@ sftp_packet sftp_packet_read(sftp_session sftp) {
|
|||||||
buffer_get_u8(packet->payload, &packet->type);
|
buffer_get_u8(packet->payload, &packet->type);
|
||||||
|
|
||||||
size = ntohl(size);
|
size = ntohl(size);
|
||||||
if (size == 0) {
|
if (size == 0 || size > UINT_MAX) {
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
size--;
|
size--;
|
||||||
|
|||||||
Reference in New Issue
Block a user