]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pcrlock: check for embedded NUL bytes
authorLennart Poettering <lennart@poettering.net>
Mon, 20 Nov 2023 13:26:18 +0000 (14:26 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 20 Nov 2023 13:27:38 +0000 (14:27 +0100)
src/pcrlock/pcrlock.c

index 9978ffe71a66ade7694d5693f6b24d9df8e0529b..dc48bc57e5628eb2566b7011f4d3e183e15010e9 100644 (file)
@@ -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");