]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Fix bug in DetectFlowintParse() - Assigning to both parts of a Union
authorKen Steele <ken@tilera.com>
Mon, 10 Nov 2014 19:48:29 +0000 (14:48 -0500)
committerVictor Julien <victor@inliniac.net>
Thu, 27 Nov 2014 15:22:24 +0000 (16:22 +0100)
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

index 5c3bc193a83d0d77f031b937a112bf211d5440e5..fae82cc4bd9753f152e6fd0d79d05243e87d8571 100644 (file)
@@ -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);