From c547d391523b761c67ebd0524ab603e5d8e7bdcc Mon Sep 17 00:00:00 2001 From: Ken Steele Date: Mon, 10 Nov 2014 14:48:29 -0500 Subject: [PATCH] Fix bug in DetectFlowintParse() - Assigning to both parts of a Union sfd->target.value was always being set, even if the targettype was not FLOWINT_TARGET_VAL. This would cause the tvar to be overwritten with garbage data. --- src/detect-flowint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detect-flowint.c b/src/detect-flowint.c index 5c3bc193a8..fae82cc4bd 100644 --- a/src/detect-flowint.c +++ b/src/detect-flowint.c @@ -322,6 +322,7 @@ DetectFlowintData *DetectFlowintParse(DetectEngineCtx *de_ctx, char *rawstr) " Values should be between 0 and %"PRIu32, UINT32_MAX); goto error; } + sfd->target.value = (uint32_t) value_long; } else { sfd->targettype = FLOWINT_TARGET_VAR; sfd->target.tvar.name = SCStrdup(varval); @@ -342,7 +343,6 @@ DetectFlowintData *DetectFlowintParse(DetectEngineCtx *de_ctx, char *rawstr) } if (de_ctx != NULL) sfd->idx = VariableNameGetIdx(de_ctx, varname, DETECT_FLOWINT); - sfd->target.value = (uint32_t) value_long; sfd->modifier = modifier; pcre_free_substring(varname);