tracing/filters: Fix MATCH_MIDDLE_ONLY filter matching
authorLi Zefan <lizf@cn.fujitsu.com>
Thu, 14 Jan 2010 02:54:11 +0000 (10:54 +0800)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 15 Jan 2010 03:38:11 +0000 (22:38 -0500)
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>
kernel/trace/trace_events_filter.c

index 49e44dd1785126ce5d96e7e1cb416b32f76c8821..f364b085397e0931346fb3ee30394095e8e2db4b 100644 (file)
@@ -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;
 }