From: Lennart Poettering Date: Tue, 21 Nov 2023 08:59:46 +0000 (+0100) Subject: creds-util: automatically append NUL byte to decrypted creds X-Git-Tag: v256-rc1~1289 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42301b6d963dff7ffe36adca9b0a373030a7c5fe;p=thirdparty%2Fsystemd.git 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 --- 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();