Adds capture of ssl->arrays->sessionIDSz at DoServerHello.

This commit is contained in:
Moisés Guimarães
2014-10-13 23:04:31 -03:00
parent e98eb1ba4d
commit 6956d146d1

View File

@ -9011,7 +9011,6 @@ static void PickHashSigAlgo(CYASSL* ssl,
static int DoServerHello(CYASSL* ssl, const byte* input, word32* inOutIdx, static int DoServerHello(CYASSL* ssl, const byte* input, word32* inOutIdx,
word32 helloSz) word32 helloSz)
{ {
byte b;
byte cs0; /* cipher suite bytes 0, 1 */ byte cs0; /* cipher suite bytes 0, 1 */
byte cs1; byte cs1;
ProtocolVersion pv; ProtocolVersion pv;
@ -9077,18 +9076,20 @@ static void PickHashSigAlgo(CYASSL* ssl,
i += RAN_LEN; i += RAN_LEN;
/* session id */ /* session id */
b = input[i++]; ssl->arrays->sessionIDSz = input[i++];
if (b > ID_LEN) { if (ssl->arrays->sessionIDSz > ID_LEN) {
CYASSL_MSG("Invalid session ID size"); CYASSL_MSG("Invalid session ID size");
ssl->arrays->sessionIDSz = 0;
return BUFFER_ERROR; return BUFFER_ERROR;
} }
else if (b) { else if (ssl->arrays->sessionIDSz) {
if ((i - begin) + b > helloSz) if ((i - begin) + ssl->arrays->sessionIDSz > helloSz)
return BUFFER_ERROR; return BUFFER_ERROR;
XMEMCPY(ssl->arrays->sessionID, input + i, b); XMEMCPY(ssl->arrays->sessionID, input + i,
i += b; ssl->arrays->sessionIDSz);
i += ssl->arrays->sessionIDSz;
ssl->options.haveSessionId = 1; ssl->options.haveSessionId = 1;
} }