Topic: Initialization of Ticket Buffer before using wolfSSL_get_SessionTicket
Hi,
I was trying to use on the server the function wolfSSL_get_SessionTicket to get the Client's Session ID. After some debugging to determine why I was getting a Bad function argument. After this I looked at the ssl.c code and I noticed the problem:
WOLFSSL_API int wolfSSL_get_SessionTicket(WOLFSSL* ssl, byte* buf, word32* bufSz)
{
if (ssl == NULL || buf == NULL || bufSz == NULL || *bufSz == 0)
return BAD_FUNC_ARG;
if (ssl->session.ticketLen <= *bufSz) {
XMEMCPY(buf, ssl->session.ticket, ssl->session.ticketLen);
*bufSz = ssl->session.ticketLen;
}
else
*bufSz = 0;
return SSL_SUCCESS;
}
This requires the Buffer not to be NULL and the size variable to be equal to the size of the buffer. This makes little sense unless there is a initialization function for the Ticket buffer. Suggest that the if Statement is changed to:
if ( ssl==NULL || *bufSz < ID_LEN)
cfarrin