forked from wolfSSL/wolfssl
have allocate extra byte in case user wants to null terminate returned plaintext
This commit is contained in:
@ -3078,7 +3078,9 @@ doPart:
|
|||||||
TraceGotData(ret);
|
TraceGotData(ret);
|
||||||
if (ret) { /* may be blank message */
|
if (ret) { /* may be blank message */
|
||||||
byte* tmpData; /* don't leak on realloc free */
|
byte* tmpData; /* don't leak on realloc free */
|
||||||
tmpData = (byte*)realloc(*data, decoded + ret);
|
/* add an extra byte at end of allocation in case user
|
||||||
|
* wants to null terminate plaintext */
|
||||||
|
tmpData = (byte*)realloc(*data, decoded + ret + 1);
|
||||||
if (tmpData == NULL) {
|
if (tmpData == NULL) {
|
||||||
free(*data);
|
free(*data);
|
||||||
*data = NULL;
|
*data = NULL;
|
||||||
|
Reference in New Issue
Block a user