~martijnbraam/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH] kmsg parsing: skip flag field and don't crash if it's missing

Adam Mizerski <adam@mizerski.pl>
Details
Message ID
<20240819084809.178290-1-adam@mizerski.pl>
DKIM signature
pass
Download raw message
Patch: +1 -12
---
 main.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/main.c b/main.c
index b477e1a..dd1ab8b 100644
--- a/main.c
+++ b/main.c
@@ -335,18 +335,7 @@ parse_kmsg_line(char *buffer, ssize_t size)
	end = NULL;
	long ts = strtol(buffer, &end, 10);
	if (end && end > buffer) {
		buffer = end + 1;
	}

	long flags = 0;
	if (buffer[0] == '-') {
		buffer += 1;
	} else {
		end = NULL;
		flags = strtol(buffer, &end, 10);
		if (end && end > buffer) {
			buffer = end;
		}
		buffer = end;
	}

	while (*buffer != ';') {
-- 
2.46.0
Reply to thread Export thread (mbox)