From 9e6b897ebcbc09fb85177fede8797bbae58d7958 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Sat, 17 Apr 2010 23:00:09 +0200 Subject: [PATCH] Improve detect-threshold parser error handling. --- src/detect-threshold.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/detect-threshold.c b/src/detect-threshold.c index ccbe5f72df..5fc010323f 100644 --- a/src/detect-threshold.c +++ b/src/detect-threshold.c @@ -158,16 +158,18 @@ static DetectThresholdData *DetectThresholdParse (char *rawstr) second_pos = i+1; } - if (args[count_pos] != NULL && - (ByteExtractStringUint32(&de->count, 10, strlen(args[count_pos]), - args[count_pos]) <= 0)) + if (args[count_pos] == NULL) { + goto error; + } + + if (ByteExtractStringUint32(&de->count, 10, strlen(args[count_pos]), + args[count_pos]) <= 0) { goto error; } - if (args[second_pos] != NULL && - ByteExtractStringUint32(&de->seconds, 10, strlen(args[second_pos]), - args[second_pos]) <= 0) + if (ByteExtractStringUint32(&de->seconds, 10, strlen(args[second_pos]), + args[second_pos]) <= 0) { goto error; }