]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
creds-util: automatically append NUL byte to decrypted creds
authorLennart Poettering <lennart@poettering.net>
Tue, 21 Nov 2023 08:59:46 +0000 (09:59 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 4 Jan 2024 21:57:04 +0000 (22:57 +0100)
Both as safety net and as convenience feature of a string is contained
in the credential

src/shared/creds-util.c

index 1c12fdfa9fad7e1980b42e78ab02384f08d73a61..22c5e4231104b449506925c97daa1d6290840988 100644 (file)
@@ -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();