Skip to content

Commit 4346be6

Browse files
neosys007mhiramat
authored andcommitted
tracing/probe: reject non-closed empty immediate strings
parse_probe_arg() accepts quoted immediate strings and passes the body after the opening quote to __parse_imm_string(). That helper currently computes strlen(str) and immediately dereferences str[len - 1], which underflows when the body is empty and not closed with double-quotation. Reject empty non-closed immediate strings before checking for the closing quote. Link: https://lore.kernel.org/all/20260401160315.88518-1-pengpeng@iscas.ac.cn/ Fixes: a42e3c4 ("tracing/probe: Add immediate string parameter support") Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
1 parent 591cd65 commit 4346be6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/trace/trace_probe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ static int __parse_imm_string(char *str, char **pbuf, int offs)
10681068
{
10691069
size_t len = strlen(str);
10701070

1071-
if (str[len - 1] != '"') {
1071+
if (!len || str[len - 1] != '"') {
10721072
trace_probe_log_err(offs + len, IMMSTR_NO_CLOSE);
10731073
return -EINVAL;
10741074
}

0 commit comments

Comments
 (0)