Message ID | 20221219222630.54fc5bc5@gandalf.local.home (mailing list archive) |
---|---|
State | Accepted |
Commit | 8be5640ff4e64ca07b9c711afc0af89c958ed4f2 |
Headers | show |
Series | libtraceevent: Fix string parsing | expand |
diff --git a/src/event-parse.c b/src/event-parse.c index b37d81a89bf8..8167777fccd7 100644 --- a/src/event-parse.c +++ b/src/event-parse.c @@ -1303,10 +1303,15 @@ static enum tep_event_type __read_token(struct tep_handle *tep, char **tok) if (ch == '\\' && last_ch == '\\') last_ch = 0; /* Break out if the file is corrupted and giving non print chars */ + if (ch <= 0) + break; } while ((ch != quote_ch && isprint(ch)) || last_ch == '\\' || ch == '\n'); /* remove the last quote */ i--; + if (ch <= 0) + type = TEP_EVENT_NONE; + /* * For strings (double quotes) check the next token. * If it is another string, concatinate the two.