Skip to content

Commit a696d11

Browse files
committed
if len is 0, do not subtract 1 when calling XMALLOC
1 parent 1766b91 commit a696d11

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/tls13.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5877,7 +5877,7 @@ static int DoTls13CertificateRequest(WOLFSSL* ssl, const byte* input,
58775877
* Increase size to handle other implementations sending more than one byte.
58785878
* That is, allocate extra space, over one byte, to hold the context value.
58795879
*/
5880-
certReqCtx = (CertReqCtx*)XMALLOC(sizeof(CertReqCtx) + len - 1, ssl->heap,
5880+
certReqCtx = (CertReqCtx*)XMALLOC(sizeof(CertReqCtx) + (len == 0 ? 0 : len - 1), ssl->heap,
58815881
DYNAMIC_TYPE_TMP_BUFFER);
58825882
if (certReqCtx == NULL)
58835883
return MEMORY_E;

0 commit comments

Comments
 (0)