diff options
author | Martin Mathieson <martin.r.mathieson@googlemail.com> | 2017-06-22 13:36:33 +0100 |
---|---|---|
committer | Martin Mathieson <martin.r.mathieson@googlemail.com> | 2017-06-23 15:07:06 +0000 |
commit | 8a3e4650674a36fdfe7b38c60c8d83b4dfec0d11 (patch) | |
tree | 450b1f914d81d5235c470cc252acb87328e075e9 /epan/dissectors/snort-config.c | |
parent | 082e3e346f69f0c2134064e80dcc104c18111c55 (diff) |
Snort content matching fixes
Cope with a space between colon and start of options value.
When there are no constraining modifiers, let match for
next content or pcre field start from beginning of payload
again.
Change-Id: Ie1267a0a38143cbe9f0444945f78708bbefaa270
Reviewed-on: https://code.wireshark.org/review/22365
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
Diffstat (limited to 'epan/dissectors/snort-config.c')
-rw-r--r-- | epan/dissectors/snort-config.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/epan/dissectors/snort-config.c b/epan/dissectors/snort-config.c index b8d17dcfe8..7b5ea08019 100644 --- a/epan/dissectors/snort-config.c +++ b/epan/dissectors/snort-config.c @@ -611,11 +611,16 @@ static void process_rule_option(Rule_t *rule, char *options, int option_start_of value[0] = '\0'; gint value_length = 0; guint32 value32 = 0; + gint spaces_after_colon = 0; if (colon_offset != 0) { /* Name and value */ g_snprintf(name, colon_offset-option_start_offset, "%s", options+option_start_offset); - g_snprintf(value, options_end_offset-colon_offset, "%s", options+colon_offset); + if (options[colon_offset] == ' ') { + spaces_after_colon = 1; + } + g_snprintf(value, options_end_offset-spaces_after_colon-colon_offset, "%s", + options+colon_offset+spaces_after_colon); value_length = (gint)strlen(value); } else { @@ -657,7 +662,7 @@ static void process_rule_option(Rule_t *rule, char *options, int option_start_of } } - value[options_end_offset-colon_offset-2] = '\0'; + value[options_end_offset-colon_offset-spaces_after_colon-2] = '\0'; rule_add_content(rule, value+value_start+1, value_start == 1); } else if (strcmp(name, "uricontent") == 0) { @@ -675,7 +680,7 @@ static void process_rule_option(Rule_t *rule, char *options, int option_start_of } } - value[options_end_offset-colon_offset-2] = '\0'; + value[options_end_offset-colon_offset-spaces_after_colon-2] = '\0'; rule_add_uricontent(rule, value+value_start+1, value_start == 1); } else if (strcmp(name, "http_uri") == 0) { @@ -691,7 +696,7 @@ static void process_rule_option(Rule_t *rule, char *options, int option_start_of /* Not expecting negation (!)... */ - value[options_end_offset-colon_offset-2] = '\0'; + value[options_end_offset-colon_offset-spaces_after_colon-2] = '\0'; rule_add_pcre(rule, value+value_start+1); } else if (strcmp(name, "nocase") == 0) { |