1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-21 14:00:51 +03:00

transport.c: fix use-of-uninitialized-value (#476)

file:transport.c

notes:
return error if malloc(0)

credit:
lutianxiong
This commit is contained in:
lutianxiong
2020-05-29 01:25:40 +08:00
committed by GitHub
parent 1105af5651
commit 642eec48ff

View File

@@ -472,7 +472,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION * session)
/* Get a packet handle put data into. We get one to /* Get a packet handle put data into. We get one to
hold all data, including padding and MAC. */ hold all data, including padding and MAC. */
p->payload = LIBSSH2_ALLOC(session, total_num); p->payload = LIBSSH2_ALLOC(session, total_num);
if(!p->payload) { if(total_num == 0 || !p->payload) {
return LIBSSH2_ERROR_ALLOC; return LIBSSH2_ERROR_ALLOC;
} }
p->total_num = total_num; p->total_num = total_num;