From 42301b6d963dff7ffe36adca9b0a373030a7c5fe Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 21 Nov 2023 09:59:46 +0100 Subject: [PATCH] creds-util: automatically append NUL byte to decrypted creds Both as safety net and as convenience feature of a string is contained in the credential --- src/shared/creds-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/creds-util.c b/src/shared/creds-util.c index 1c12fdfa9fa..22c5e423110 100644 --- a/src/shared/creds-util.c +++ b/src/shared/creds-util.c @@ -1376,7 +1376,7 @@ int decrypt_credential_and_warn( if (ret) { char *without_metadata; - without_metadata = memdup((uint8_t*) plaintext + hs, plaintext_size - hs); + without_metadata = memdup_suffix0((uint8_t*) plaintext + hs, plaintext_size - hs); if (!without_metadata) return log_oom(); -- 2.47.3