systemd/0585-tpm2-use-SIZE_MAX-inst...

26 lines
983 B
Diff

From 58681f650a4ccd8a138eb0d5e45665d7973f4d43 Mon Sep 17 00:00:00 2001
From: Dan Streetman <ddstreet@ieee.org>
Date: Mon, 21 Aug 2023 16:29:44 -0400
Subject: [PATCH] tpm2: use SIZE_MAX instead of strlen() for unhexmem()
(cherry picked from commit 7001a7daf7b2cf67991acc8383a58ff71432188c)
Related: RHEL-16182
---
src/shared/tpm2-util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/tpm2-util.c b/src/shared/tpm2-util.c
index a91e805e06..4da2143360 100644
--- a/src/shared/tpm2-util.c
+++ b/src/shared/tpm2-util.c
@@ -1733,7 +1733,7 @@ int tpm2_pcr_value_from_string(const char *arg, Tpm2PCRValue *ret_pcr_value) {
_cleanup_free_ void *buf = NULL;
size_t buf_size = 0;
- r = unhexmem(p, strlen(p), &buf, &buf_size);
+ r = unhexmem(p, SIZE_MAX, &buf, &buf_size);
if (r < 0)
return log_error_errno(r, "Invalid pcr hash value '%s': %m", p);