From 7dd1cd18373a6c64ecea8caf231e10a00764f705 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Mon, 10 Nov 2025 09:43:30 +0100 Subject: lib: Fix buffer in auth_test and tpm log The string buffer in auth_test was one byte too short. The log line for the thread id in the tpm thread debug output needs type conversion. The build fails because of this on OS X. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/tests/auth_test.c | 3 ++- src/lib/tpm.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/tests/auth_test.c b/src/lib/tests/auth_test.c index ede294b8..896c42b0 100644 --- a/src/lib/tests/auth_test.c +++ b/src/lib/tests/auth_test.c @@ -90,6 +90,7 @@ static const char * server_ec_pk = \ "-----END PUBLIC KEY-----\n"; /* Valid signed server certificate for test-1.unittest.o7s */ +#define SSC_TEXT_SIZE 2295 /* size of cleartext certificate */ static const char * signed_server_crt = \ "-----BEGIN CERTIFICATE-----\n" "MIIDiTCCAy+gAwIBAgICEAUwCgYIKoZIzj0EAwIwWjELMAkGA1UEBhMCQkUxDDAK\n" @@ -573,7 +574,7 @@ int test_auth_bad_signature(void) int test_crt_str(void) { - char str[2295]; + char str[SSC_TEXT_SIZE + 1]; void * crt; TEST_START(); diff --git a/src/lib/tpm.c b/src/lib/tpm.c index 7a17ef6b..ad5c1068 100644 --- a/src/lib/tpm.c +++ b/src/lib/tpm.c @@ -100,7 +100,7 @@ static void tpm_debug_thread(struct pthr_el * e) if (BETWEEN(TPM_DEBUG_REPORT_INTERVAL, 0, intv)) { log_dbg("Thread %d:%lx running for %ld s.\n", - getpid(),e->thr, diff); + getpid(), (unsigned long) e->thr, diff); e->last = now; } -- cgit v1.2.3