summaryrefslogtreecommitdiffstats
path: root/src/pcrlock/pcrlock.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-11-20 14:25:56 +0100
committerLennart Poettering <lennart@poettering.net>2023-11-20 14:27:27 +0100
commit8c8d2cfd4bc890acfc92ff0fd4269be05adfc5ef (patch)
treed207c87561c9585f0d7cea0f10e00091c9679ee0 /src/pcrlock/pcrlock.c
parentman: add note about journald forwarding being sync (diff)
downloadsystemd-8c8d2cfd4bc890acfc92ff0fd4269be05adfc5ef.tar.xz
systemd-8c8d2cfd4bc890acfc92ff0fd4269be05adfc5ef.zip
pcrlock: make sure we don't choke on empty records
Follow-up for a43427013949 CID#1523832
Diffstat (limited to '')
-rw-r--r--src/pcrlock/pcrlock.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pcrlock/pcrlock.c b/src/pcrlock/pcrlock.c
index 0469fc943f..9978ffe71a 100644
--- a/src/pcrlock/pcrlock.c
+++ b/src/pcrlock/pcrlock.c
@@ -1120,7 +1120,11 @@ static int event_log_load_userspace(EventLog *el) {
continue;
}
- b[bn] = 0;
+ if (!GREEDY_REALLOC(b, bn + 1))
+ return log_oom();
+
+ b[bn] = 0; /* Turn it into a string */
+
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");