libtraceevent: Have single quotes represent characters
PATCH 1/1 libtraceevent: Have single quotes represent characters
From: "Steven Rostedt (Google)" <[email protected]>
In parsing the print fmt parameters, the code currently treats both single and double quotes the same. But they are not. Double quotes represent strings and single quotes represent characters.
A character could be used as a number as well, so it needs to be treated as such.
Fixes 6582b0aea1cc ("tools/events: Add files to create libtraceevent.a")
Reported-by Luca Ceresoli <[email protected]>
Signed-off-by Steven Rostedt (Google) <[email protected]>
--- src/event-parse.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
src/event-parse.c +12 -1
@@ -3732,8 +3732,19 @@ process_arg_token(struct tep_event *event, struct tep_print_arg *arg, arg->atom.atom = atom;break ; -case TEP_EVENT_DQUOTE :case TEP_EVENT_SQUOTE : + arg->type =TEP_PRINT_ATOM ; +/* Make characters into numbers */ +if (asprintf (&arg->atom.atom,"%d" , token[0 ]) <0 ) { +free_token (token); + *tok =NULL ; + arg->atom.atom =NULL ; +return TEP_EVENT_ERROR ; + } +free_token (token); + type =read_token_item (event->tep, &token); +break ; +case TEP_EVENT_DQUOTE : arg->type =TEP_PRINT_ATOM ; arg->atom.atom = token; type =read_token_item (event->tep, &token);
Signature · 1 line
2.43.0