From 1a15dcaf10749830a2c6b0b83f6c96de061944f4 Mon Sep 17 00:00:00 2001 From: Pablo Rincon Date: Wed, 30 Jun 2010 18:10:58 +0200 Subject: [PATCH] This patch for app-layer-ssl fix the bug #198 (SSLParserTest01). It seems that with -O2 and -O3, the compiler doesn't handle the initialization correctly (weird..) --- src/app-layer-ssl.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app-layer-ssl.c b/src/app-layer-ssl.c index 3f172bf..26230b5 100644 --- a/src/app-layer-ssl.c +++ b/src/app-layer-ssl.c @@ -65,6 +65,8 @@ static int SSLParseClientRecord(Flow *f, void *ssl_state, AppLayerParserState *p AppLayerParserResult *output) { SCEnter(); + SslClient *client = NULL; + SslState *ssl_st = NULL; /* SSL client message should be larger than 9 bytes as we need to know, to what is the SSL version and message type */ @@ -74,8 +76,8 @@ static int SSLParseClientRecord(Flow *f, void *ssl_state, AppLayerParserState *p SCReturnInt(1); } - SslClient *client = (SslClient *)input; - SslState *ssl_st = (SslState *)ssl_state; + client = (SslClient *)input; + ssl_st = (SslState *)ssl_state; switch (client->msg_type) { case SSL_CLIENT_HELLO: @@ -259,8 +261,11 @@ extern uint16_t AppLayerParserGetStorageId (void); static int SSLParserTest01(void) { int result = 0; Flow f; - uint8_t sslbuf[] = {0x80, 0x31, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 }; - uint32_t ssllen = sizeof(sslbuf); + uint8_t *sslbuf = (uint8_t *) "\x80\x31\x01\x00\x02\x00\x00\x00\x01"; + + /* PrintRawDataFp(stdout, sslbuf, 9); */ + + uint32_t ssllen = 9; TcpSession ssn; memset(&f, 0, sizeof(f)); @@ -316,6 +321,7 @@ static int SSLParserTest02(void) { 0x2f, 0x34, 0x84, 0x20, 0xc5}; uint32_t ssllen = sizeof(sslbuf); TcpSession ssn; + AppLayerDetectProtoThreadInit(); memset(&f, 0, sizeof(f)); memset(&ssn, 0, sizeof(ssn)); -- 1.6.0.4