]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: fix -Wunterminated-string-initialization warning
authorKarel Zak <kzak@redhat.com>
Mon, 13 Jul 2026 13:45:26 +0000 (15:45 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 14 Jul 2026 12:39:33 +0000 (14:39 +0200)
The "xx\0" string literal is 4 bytes but buf is only 3, truncating
the NUL terminator.  Since the buffer is immediately overwritten by
memcpy, just zero-initialize it instead.

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/hook_veritydev.c

index 92c89b0bec88207d2739f3d135be5d9549e90c7f..101b2209ed15adf195cf32548956c448409b2c6f 100644 (file)
@@ -174,7 +174,7 @@ static void delete_veritydev(struct libmnt_context *cxt,
 /* Taken from https://gitlab.com/cryptsetup/cryptsetup/blob/master/lib/utils_crypt.c#L225 */
 static size_t crypt_hex_to_bytes(const char *hex, char **result)
 {
-       char buf[3] = "xx\0", *endp, *bytes;
+       char buf[3] = { 0 }, *endp, *bytes;
        size_t i, len;
 
        len = strlen(hex);