Message ID | 20211123171003.7e24cd37@gandalf.local.home (mailing list archive) |
---|---|
State | Accepted |
Commit | d0fbd046a090834ac1ee69d45f321d7fa2a5c9b4 |
Headers | show |
Series | libtraceevent: Do not read non printable characters | expand |
diff --git a/src/event-parse.c b/src/event-parse.c index 7063758..c3ea98e 100644 --- a/src/event-parse.c +++ b/src/event-parse.c @@ -1246,7 +1246,8 @@ static enum tep_event_type __read_token(char **tok) /* the '\' '\' will cancel itself */ if (ch == '\\' && last_ch == '\\') last_ch = 0; - } while (ch != quote_ch || last_ch == '\\'); + /* Break out if the file is corrupted and giving non print chars */ + } while ((ch != quote_ch && isprint(ch)) || last_ch == '\\'); /* remove the last quote */ i--;