mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
tracing/filters: Fix MATCH_MIDDLE_ONLY filter matching
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>
This commit is contained in:
parent
d5f1fb5335
commit
b2af211f28
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue