From a11b3a1aa28467f91095d9be569ea58dca7fa2ca Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 27 May 2011 11:23:03 +0200 Subject: [PATCH] Fix potential parsing issue in threshold code. --- src/detect-threshold.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/detect-threshold.c b/src/detect-threshold.c index 65d6aec323..b3d7d5122c 100644 --- a/src/detect-threshold.c +++ b/src/detect-threshold.c @@ -121,6 +121,8 @@ static DetectThresholdData *DetectThresholdParse (char *rawstr) int i = 0; copy_str = SCStrdup(rawstr); + if (copy_str == NULL) + goto error; for(pos = 0, threshold_opt = strtok(copy_str,","); pos < strlen(copy_str) && threshold_opt != NULL; pos++, threshold_opt = strtok(NULL,",")) { @@ -134,8 +136,7 @@ static DetectThresholdData *DetectThresholdParse (char *rawstr) track_found++; } - if(copy_str) - SCFree(copy_str); + SCFree(copy_str); if(count_found != 1 || second_found != 1 || type_found != 1 || track_found != 1) goto error;