1
0
mirror of https://github.com/libssh2/libssh2.git synced 2026-01-27 00:18:12 +03:00

transport.c : fixes bounds check if partial packet is read

Files : transport.c

Issue : #360

Notes : 
 'p->total_num' instead of local value total_num when doing bounds check.

Credit : Doublex
This commit is contained in:
doublex
2019-04-24 18:55:59 +02:00
committed by Will Cosgrove
parent 1cdbe63d0c
commit f5e84ae241

View File

@@ -565,7 +565,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION * session)
copy them as-is to the target buffer */
if(numbytes > 0) {
if(numbytes <= (int)(total_num - (p->wptr - p->payload))) {
if(numbytes <= (int)(p->total_num - (p->wptr - p->payload))) {
memcpy(p->wptr, &p->buf[p->readidx], numbytes);
}
else {