[PATCH] libtraceevent: Do not read non printable characters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Cliff Wickman <cliff.wickman@xxxxxxx>

libtraceevent is getting into a loop if the trace.dat file contains
corrupted strings ending in non-printable characters instead of quotes.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215121
Signed-off-by: Cliff Wickman <cliff.wickman@xxxxxxx>
Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
 src/event-parse.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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--;
 
-- 
2.31.1




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux