forked from wolfSSL/wolfssl
handle sniffer realloc failure w/o leak
This commit is contained in:
@@ -3077,12 +3077,16 @@ doPart:
|
|||||||
ret = ssl->buffers.clearOutputBuffer.length;
|
ret = ssl->buffers.clearOutputBuffer.length;
|
||||||
TraceGotData(ret);
|
TraceGotData(ret);
|
||||||
if (ret) { /* may be blank message */
|
if (ret) { /* may be blank message */
|
||||||
*data = realloc(*data, decoded + ret);
|
byte* tmpData; /* don't leak on realloc free */
|
||||||
if (*data == NULL) {
|
tmpData = (byte*)realloc(*data, decoded + ret);
|
||||||
|
if (tmpData == NULL) {
|
||||||
|
free(*data);
|
||||||
|
*data = NULL;
|
||||||
SetError(MEMORY_STR, error, session,
|
SetError(MEMORY_STR, error, session,
|
||||||
FATAL_ERROR_STATE);
|
FATAL_ERROR_STATE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
*data = tmpData;
|
||||||
XMEMCPY(*data + decoded,
|
XMEMCPY(*data + decoded,
|
||||||
ssl->buffers.clearOutputBuffer.buffer, ret);
|
ssl->buffers.clearOutputBuffer.buffer, ret);
|
||||||
TraceAddedData(ret, decoded);
|
TraceAddedData(ret, decoded);
|
||||||
|
Reference in New Issue
Block a user