mirror of https://github.com/wolfSSL/wolfssh.git
Maintenance: RX/TX
1. Before attempting to resize the output buffer in PreparePacket, make sure the length and index in the output buffer is consistent. 2. If SendPacket gets a general error back from the call to the transmit I/O callback, flush the output buffer and return the general error upstream.pull/222/head
parent
b8f18d9459
commit
b9ca9824b2
|
@ -1448,6 +1448,10 @@ int wolfSSH_SendPacket(WOLFSSH* ssh)
|
|||
case WS_CBIO_ERR_CONN_CLOSE: /* peer closed connection */
|
||||
ssh->isClosed = 1;
|
||||
break;
|
||||
|
||||
case WS_CBIO_ERR_GENERAL:
|
||||
ShrinkBuffer(&ssh->outputBuffer, 1);
|
||||
FALL_THROUGH
|
||||
}
|
||||
return WS_SOCKET_ERROR_E;
|
||||
}
|
||||
|
@ -5288,6 +5292,9 @@ static int PreparePacket(WOLFSSH* ssh, word32 payloadSz)
|
|||
if (ssh == NULL)
|
||||
ret = WS_BAD_ARGUMENT;
|
||||
|
||||
if (ssh->outputBuffer.length < ssh->outputBuffer.idx)
|
||||
ret = WS_OVERFLOW_E;
|
||||
|
||||
if (ret == WS_SUCCESS) {
|
||||
word32 packetSz, usedSz, outputSz;
|
||||
byte paddingSz;
|
||||
|
|
Loading…
Reference in New Issue