mirror of https://github.com/wolfSSL/wolfssh.git
add sanity check on amount requested to be sent
parent
5949cd32de
commit
ec6e7463d2
|
@ -1456,7 +1456,16 @@ int wolfSSH_SendPacket(WOLFSSH* ssh)
|
|||
}
|
||||
|
||||
while (ssh->outputBuffer.length > 0) {
|
||||
int sent = ssh->ctx->ioSendCb(ssh,
|
||||
int sent;
|
||||
|
||||
/* sanity check on amount requested to be sent */
|
||||
if (ssh->outputBuffer.idx + ssh->outputBuffer.length >
|
||||
ssh->outputBuffer.bufferSz) {
|
||||
WLOG(WS_LOG_ERROR, "Bad buffer state");
|
||||
return WS_BUFFER_E;
|
||||
}
|
||||
|
||||
sent = ssh->ctx->ioSendCb(ssh,
|
||||
ssh->outputBuffer.buffer + ssh->outputBuffer.idx,
|
||||
ssh->outputBuffer.length, ssh->ioWriteCtx);
|
||||
|
||||
|
|
Loading…
Reference in New Issue