mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-21 14:00:51 +03:00
file: transport.c notes: moving total_num zero length check from #476 up to the prior bounds check which already includes a total_num check. Makes it slightly more readable. credit: Will Cosgrove
This commit is contained in:
@@ -465,14 +465,14 @@ int _libssh2_transport_read(LIBSSH2_SESSION * session)
|
|||||||
* or less (including length, padding length, payload,
|
* or less (including length, padding length, payload,
|
||||||
* padding, and MAC.)."
|
* padding, and MAC.)."
|
||||||
*/
|
*/
|
||||||
if(total_num > LIBSSH2_PACKET_MAXPAYLOAD) {
|
if(total_num > LIBSSH2_PACKET_MAXPAYLOAD || total_num == 0) {
|
||||||
return LIBSSH2_ERROR_OUT_OF_BOUNDARY;
|
return LIBSSH2_ERROR_OUT_OF_BOUNDARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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(total_num == 0 || !p->payload) {
|
if(!p->payload) {
|
||||||
return LIBSSH2_ERROR_ALLOC;
|
return LIBSSH2_ERROR_ALLOC;
|
||||||
}
|
}
|
||||||
p->total_num = total_num;
|
p->total_num = total_num;
|
||||||
|
|||||||
Reference in New Issue
Block a user