From 3ffbb4c3f40285534c949cf2d986aa5898d91a4d Mon Sep 17 00:00:00 2001 From: Gurvinder Singh Date: Sun, 18 Apr 2010 07:22:06 +0200 Subject: [PATCH] fixed more api and logic erros in recent master --- src/detect-detection-filter.c | 10 ++++------ src/detect-http-cookie.c | 10 +++++----- src/detect-threshold.c | 10 ++++------ 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/detect-detection-filter.c b/src/detect-detection-filter.c index 68aacaaf65..c836982511 100644 --- a/src/detect-detection-filter.c +++ b/src/detect-detection-filter.c @@ -147,17 +147,15 @@ DetectThresholdData *DetectDetectionFilterParse (char *rawstr) { seconds_pos = i+1; } - if (args[count_pos] == NULL) { - goto error; - } - - if (ByteExtractStringUint32(&df->count, 10, strlen(args[count_pos]), + if (args[count_pos] == NULL|| + ByteExtractStringUint32(&df->count, 10, strlen(args[count_pos]), args[count_pos]) <= 0) { goto error; } - if (ByteExtractStringUint32(&df->seconds, 10, strlen(args[seconds_pos]), + if (args[seconds_pos] == NULL || + ByteExtractStringUint32(&df->seconds, 10, strlen(args[seconds_pos]), args[seconds_pos]) <= 0) { goto error; diff --git a/src/detect-http-cookie.c b/src/detect-http-cookie.c index 6c4755b3fa..678c48deb7 100644 --- a/src/detect-http-cookie.c +++ b/src/detect-http-cookie.c @@ -651,7 +651,7 @@ static int DetectHttpCookieSigTest03(void) { Packet p; Signature *s = NULL; ThreadVars th_v; - DetectEngineThreadCtx *det_ctx; + DetectEngineThreadCtx *det_ctx = NULL; HtpState *http_state = NULL; memset(&th_v, 0, sizeof(th_v)); @@ -743,7 +743,7 @@ static int DetectHttpCookieSigTest04(void) { Packet p; Signature *s = NULL; ThreadVars th_v; - DetectEngineThreadCtx *det_ctx; + DetectEngineThreadCtx *det_ctx = NULL; HtpState *http_state = NULL; memset(&th_v, 0, sizeof(th_v)); @@ -835,7 +835,7 @@ static int DetectHttpCookieSigTest05(void) { Packet p; Signature *s = NULL; ThreadVars th_v; - DetectEngineThreadCtx *det_ctx; + DetectEngineThreadCtx *det_ctx = NULL; HtpState *http_state = NULL; memset(&th_v, 0, sizeof(th_v)); @@ -927,7 +927,7 @@ static int DetectHttpCookieSigTest06(void) { Packet p; Signature *s = NULL; ThreadVars th_v; - DetectEngineThreadCtx *det_ctx; + DetectEngineThreadCtx *det_ctx = NULL; HtpState *http_state = NULL; memset(&th_v, 0, sizeof(th_v)); @@ -1019,7 +1019,7 @@ static int DetectHttpCookieSigTest07(void) { Packet p; Signature *s = NULL; ThreadVars th_v; - DetectEngineThreadCtx *det_ctx; + DetectEngineThreadCtx *det_ctx = NULL; HtpState *http_state = NULL; memset(&th_v, 0, sizeof(th_v)); diff --git a/src/detect-threshold.c b/src/detect-threshold.c index 5fc010323f..01da3804ac 100644 --- a/src/detect-threshold.c +++ b/src/detect-threshold.c @@ -158,17 +158,15 @@ static DetectThresholdData *DetectThresholdParse (char *rawstr) second_pos = i+1; } - if (args[count_pos] == NULL) { - goto error; - } - - if (ByteExtractStringUint32(&de->count, 10, strlen(args[count_pos]), + if (args[count_pos] == NULL || + ByteExtractStringUint32(&de->count, 10, strlen(args[count_pos]), args[count_pos]) <= 0) { goto error; } - if (ByteExtractStringUint32(&de->seconds, 10, strlen(args[second_pos]), + if (args[second_pos] == NULL || + ByteExtractStringUint32(&de->seconds, 10, strlen(args[second_pos]), args[second_pos]) <= 0) { goto error;