Skip to content

Commit

Permalink
tracing/filters: fix off-by-one bug
Browse files Browse the repository at this point in the history
We should leave the last slot for the ending '\0'.

[ Impact: fix possible crash when the length of an operand is 128 ]

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4A0CDC8C.30602@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Li Zefan authored and Steven Rostedt committed May 15, 2009
1 parent 8cd995b commit 5872144
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/trace/trace_events_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ static inline void clear_operand_string(struct filter_parse_state *ps)

static inline int append_operand_char(struct filter_parse_state *ps, char c)
{
if (ps->operand.tail == MAX_FILTER_STR_VAL)
if (ps->operand.tail == MAX_FILTER_STR_VAL - 1)
return -EINVAL;

ps->operand.string[ps->operand.tail++] = c;
Expand Down

0 comments on commit 5872144

Please sign in to comment.