From: Karel Zak Date: Wed, 16 Aug 2017 09:55:57 +0000 (+0200) Subject: libblkid: fix compiler warning [-Wformat-truncation=] X-Git-Tag: v2.30.2~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c712bf87341b02a1cac5274e57728f9c32133983;p=thirdparty%2Futil-linux.git libblkid: fix compiler warning [-Wformat-truncation=] 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 --- diff --git a/libblkid/src/partitions/partitions.c b/libblkid/src/partitions/partitions.c index 9a11e84aa3..626e11729f 100644 --- a/libblkid/src/partitions/partitions.c +++ b/libblkid/src/partitions/partitions.c @@ -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; }