Skip to content

Commit

Permalink
tracing/filters: Fix MATCH_MIDDLE_ONLY filter matching
Browse files Browse the repository at this point in the history
The @str might not be NULL-terminated if it's of type
DYN_STRING or STATIC_STRING, so we should use strnstr()
instead of strstr().

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4B4E8753.2000102@cn.fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Li Zefan authored and Steven Rostedt committed Jan 15, 2010
1 parent d5f1fb5 commit b2af211
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/trace/trace_events_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ static int regex_match_front(char *str, struct regex *r, int len)

static int regex_match_middle(char *str, struct regex *r, int len)
{
if (strstr(str, r->pattern))
if (strnstr(str, r->pattern, len))
return 1;
return 0;
}
Expand Down

0 comments on commit b2af211

Please sign in to comment.