]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: fix compiler warning [-Wformat-truncation=]
authorKarel Zak <kzak@redhat.com>
Wed, 16 Aug 2017 09:55:57 +0000 (11:55 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 20 Sep 2017 12:18:27 +0000 (14:18 +0200)
The MBR partition pseudo-UUID is generated from table ID and partition
partno. The final UUID size limit is 37 bytes. The table ID has to be
restricted to keep compiler happy (for MBR the table ID is 8 bytes
as string).

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

index 9a11e84aa34d8b8a12d8c7741859c3161519b562..626e11729f22903f77657f93ef2d6beb869a0e28 100644 (file)
@@ -1368,7 +1368,7 @@ int blkid_partition_gen_uuid(blkid_partition par)
        if (!par || !par->tab || !*par->tab->id)
                return -1;
 
-       snprintf(par->uuid, sizeof(par->uuid), "%s-%02x",
+       snprintf(par->uuid, sizeof(par->uuid), "%.33s-%02x",
                        par->tab->id, par->partno);
        return 0;
 }