From f5e84ae24163b826d0fb39268cc44d35ca752e76 Mon Sep 17 00:00:00 2001 From: doublex Date: Wed, 24 Apr 2019 18:55:59 +0200 Subject: [PATCH] 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 --- src/transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transport.c b/src/transport.c index 44d18991..0c80c6dc 100644 --- a/src/transport.c +++ b/src/transport.c @@ -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 {