aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-05-11 13:04:35 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-05-11 13:04:35 -0700
commitc110a8b792533fc1180188b91b856bb2b3390f8b (patch)
treeead86e9bb9671da05f4143b6abdf17f98b7ce6ad
parentMerge tag 'for-linus-4.17-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip (diff)
parenttracing: Fix regex_match_front() to not over compare the test string (diff)
downloadlinux-dev-c110a8b792533fc1180188b91b856bb2b3390f8b.tar.xz
linux-dev-c110a8b792533fc1180188b91b856bb2b3390f8b.zip
Merge tag 'trace-v4.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fix from Steven Rostedt: "Working on some new updates to trace filtering, I noticed that the regex_match_front() test was updated to be limited to the size of the pattern instead of the full test string. But as the test string is not guaranteed to be nul terminated, it still needs to consider the size of the test string" * tag 'trace-v4.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Fix regex_match_front() to not over compare the test string
-rw-r--r--kernel/trace/trace_events_filter.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 1f951b3df60c..7d306b74230f 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -762,6 +762,9 @@ static int regex_match_full(char *str, struct regex *r, int len)
static int regex_match_front(char *str, struct regex *r, int len)
{
+ if (len < r->len)
+ return 0;
+
if (strncmp(str, r->pattern, r->len) == 0)
return 1;
return 0;