tpm2-tools/0003-tpm2_checkquote-Fix-missing-error-checking.patch
Štěpán Horáček 9983900131 Backport upstream fixes
Resolves: RHEL-164795

Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
2026-05-30 03:05:41 +02:00

31 lines
933 B
Diff

From 5c20a472e856b10301a4c5c0c02dc49b594f6c3f Mon Sep 17 00:00:00 2001
From: Dimitrios Siganos <dimitris@siganos.org>
Date: Sun, 9 Nov 2025 11:50:52 +0000
Subject: [PATCH 03/20] tpm2_checkquote: Fix missing error checking
The return of malloc was not checked
Signed-off-by: Dimitrios Siganos <dimitris@siganos.org>
---
tools/misc/tpm2_checkquote.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/misc/tpm2_checkquote.c b/tools/misc/tpm2_checkquote.c
index 8abf75e6..abd09619 100644
--- a/tools/misc/tpm2_checkquote.c
+++ b/tools/misc/tpm2_checkquote.c
@@ -350,6 +350,10 @@ static bool parse_marshaled_selection_data(FILE *pcr_input,
UINT32 count;
buffer = malloc(fsize);
+ if (!buffer) {
+ LOG_ERR("OOM");
+ return false;
+ }
if (!file_read_bytes_from_file(pcr_input, buffer, &size, ctx.pcr_file_path)) {
LOG_ERR("Failed to read PCR selection from file");
--
2.54.0