• Steven Rostedt (VMware)'s avatar
    tracing: Fix regex_match_front() to not over compare the test string · dc432c3d
    Steven Rostedt (VMware) authored
    The regex match function regex_match_front() in the tracing filter logic,
    was fixed to test just the pattern length from testing the entire test
    string. That is, it went from strncmp(str, r->pattern, len) to
    strcmp(str, r->pattern, r->len).
    
    The issue is that str is not guaranteed to be nul terminated, and if r->len
    is greater than the length of str, it can access more memory than is
    allocated.
    
    The solution is to add a simple test if (len < r->len) return 0.
    
    Cc: stable@vger.kernel.org
    Fixes: 285caad4 ("tracing/filters: Fix MATCH_FRONT_ONLY filter matching")
    Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
    dc432c3d
trace_events_filter.c 55.1 KB