Commit 60be76e
committed
tracing: Add size check when printing trace_marker output
If for some reason the trace_marker write does not have a nul byte for the
string, it will overflow the print:
trace_seq_printf(s, ": %s", field->buf);
The field->buf could be missing the nul byte. To prevent overflow, add the
max size that the buf can be by using the event size and the field
location.
int max = iter->ent_size - offsetof(struct print_entry, buf);
trace_seq_printf(s, ": %*.s", max, field->buf);
Link: https://lore.kernel.org/linux-trace-kernel/[email protected]
Cc: Mark Rutland <[email protected]>
Cc: Mathieu Desnoyers <[email protected]>
Reviewed-by: Masami Hiramatsu (Google) <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>1 parent b049525 commit 60be76e
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1587 | 1587 | | |
1588 | 1588 | | |
1589 | 1589 | | |
| 1590 | + | |
1590 | 1591 | | |
1591 | 1592 | | |
1592 | 1593 | | |
1593 | 1594 | | |
1594 | | - | |
| 1595 | + | |
1595 | 1596 | | |
1596 | 1597 | | |
1597 | 1598 | | |
| |||
1600 | 1601 | | |
1601 | 1602 | | |
1602 | 1603 | | |
| 1604 | + | |
1603 | 1605 | | |
1604 | 1606 | | |
1605 | 1607 | | |
1606 | | - | |
| 1608 | + | |
1607 | 1609 | | |
1608 | 1610 | | |
1609 | 1611 | | |
| |||
0 commit comments