Skip to content

Commit 0b6e2e2

Browse files
Leo-Yanmhiramat
authored andcommitted
tracing: Consider the NULL character when validating the event length
strlen() returns a string length excluding the null byte. If the string length equals to the maximum buffer length, the buffer will have no space for the NULL terminating character. This commit checks this condition and returns failure for it. Link: https://lore.kernel.org/all/[email protected]/ Fixes: dec65d7 ("tracing/probe: Check event name length correctly") Signed-off-by: Leo Yan <[email protected]> Reviewed-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
1 parent 73f3508 commit 0b6e2e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/trace/trace_probe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ int traceprobe_parse_event_name(const char **pevent, const char **pgroup,
276276
}
277277
trace_probe_log_err(offset, NO_EVENT_NAME);
278278
return -EINVAL;
279-
} else if (len > MAX_EVENT_NAME_LEN) {
279+
} else if (len >= MAX_EVENT_NAME_LEN) {
280280
trace_probe_log_err(offset, EVENT_TOO_LONG);
281281
return -EINVAL;
282282
}

0 commit comments

Comments
 (0)