From c712bf87341b02a1cac5274e57728f9c32133983 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 16 Aug 2017 11:55:57 +0200 Subject: [PATCH] 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 --- libblkid/src/partitions/partitions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.47.2