--- ./src/transport.c_ORIG 2026-08-03 01:39:10.648700410 -0500 +++ ./src/transport.c 2026-08-03 01:41:17.556949935 -0500 @@ -639,8 +639,12 @@ total_num = 4; p->packet_length = _libssh2_ntohu32(block); - if(p->packet_length < 1) + if(p->packet_length < 1){ return LIBSSH2_ERROR_DECRYPT; + } + else if(p->packet_length > LIBSSH2_PACKET_MAXPAYLOAD) { + return LIBSSH2_ERROR_OUT_OF_BOUNDARY; + } /* total_num may include size field, however due to existing * logic it needs to be removed after the entire packet is read