From: Lennart Poettering Date: Mon, 20 Nov 2023 13:26:18 +0000 (+0100) Subject: pcrlock: check for embedded NUL bytes X-Git-Tag: v255-rc3~34^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c7da9e9a65aaeb7146674c86fbd4153cd5195c55;p=thirdparty%2Fsystemd.git pcrlock: check for embedded NUL bytes --- diff --git a/src/pcrlock/pcrlock.c b/src/pcrlock/pcrlock.c index 9978ffe71a6..dc48bc57e56 100644 --- a/src/pcrlock/pcrlock.c +++ b/src/pcrlock/pcrlock.c @@ -1125,6 +1125,11 @@ static int event_log_load_userspace(EventLog *el) { b[bn] = 0; /* Turn it into a string */ + if (memchr(b, 0, bn)) { + log_warning("Found record with embedded NUL byte, skipping."); + continue; + } + r = json_parse(b, 0, &j, NULL, NULL); if (r < 0) return log_error_errno(r, "Failed to parse local TPM measurement log file: %m");