From 6956d146d160a07e899a6838f1f0e2d43a90aace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moise=CC=81s=20Guimara=CC=83es?= Date: Mon, 13 Oct 2014 23:04:31 -0300 Subject: [PATCH] Adds capture of ssl->arrays->sessionIDSz at DoServerHello. --- src/internal.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/internal.c b/src/internal.c index df4aeb9bb..9f16d2f92 100644 --- a/src/internal.c +++ b/src/internal.c @@ -9011,7 +9011,6 @@ static void PickHashSigAlgo(CYASSL* ssl, static int DoServerHello(CYASSL* ssl, const byte* input, word32* inOutIdx, word32 helloSz) { - byte b; byte cs0; /* cipher suite bytes 0, 1 */ byte cs1; ProtocolVersion pv; @@ -9077,18 +9076,20 @@ static void PickHashSigAlgo(CYASSL* ssl, i += RAN_LEN; /* 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"); + ssl->arrays->sessionIDSz = 0; return BUFFER_ERROR; } - else if (b) { - if ((i - begin) + b > helloSz) + else if (ssl->arrays->sessionIDSz) { + if ((i - begin) + ssl->arrays->sessionIDSz > helloSz) return BUFFER_ERROR; - - XMEMCPY(ssl->arrays->sessionID, input + i, b); - i += b; + + XMEMCPY(ssl->arrays->sessionID, input + i, + ssl->arrays->sessionIDSz); + i += ssl->arrays->sessionIDSz; ssl->options.haveSessionId = 1; }