History

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/

Pengpeng Hou committed 7 months ago

Commit 4346be61 parent 591cd651 file · +1 −1Browse files

Unified · Split

kernel/trace/trace_probe.c+1−1
@@ -1068,7 +1068,7 @@ static int __parse_imm_string(char *str, char **pbuf, int offs) · 1067 unmodified lines
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 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t