From 00965d44dcccd018876f60c1b64924a92feefeaf Mon Sep 17 00:00:00 2001 From: John Safranek Date: Fri, 7 Nov 2014 15:35:36 -0800 Subject: [PATCH] fix sniffer bug with detecting old client hello --- src/sniffer.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/sniffer.c b/src/sniffer.c index 114b7f82a..d67156f81 100644 --- a/src/sniffer.c +++ b/src/sniffer.c @@ -2536,16 +2536,10 @@ static int CheckPreRecord(IpInfo* ipInfo, TcpInfo* tcpInfo, if ((*session)->flags.clientHello == 0 && **sslFrame != handshake) { /* Sanity check the packet for an old style client hello. */ - int rhSize = - ((ssl->buffers.inputBuffer.buffer[ - ssl->buffers.inputBuffer.idx] & 0x7f) << 8) | - ssl->buffers.inputBuffer.buffer[ssl->buffers.inputBuffer.idx + 1]; + int rhSize = ((*sslFrame)[0] & 0x7f) | ((*sslFrame)[1]); if ((rhSize <= (*sslBytes - 2)) && - (ssl->buffers.inputBuffer.buffer[ssl->buffers.inputBuffer.idx + 2] - == OLD_HELLO_ID) && - (ssl->buffers.inputBuffer.buffer[ssl->buffers.inputBuffer.idx + 3] - == SSLv3_MAJOR)) { + (*sslFrame)[2] == OLD_HELLO_ID && (*sslFrame)[3] == SSLv3_MAJOR) { #ifdef OLD_HELLO_ALLOWED int ret = DoOldHello(*session, *sslFrame, &rhSize, sslBytes, error); if (ret < 0)