From f665f6e43c11d4c85c2c01d7bd5a571c082e47a4 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 25 Jul 2018 11:25:33 +0200 Subject: libblkid: use xstrncpy() for PT id [coverity scan] It's probably unnecessary change as blkid_parttable_set_id() is used by MBR code and we use proper buffer size there, but better safe than sorry. Signed-off-by: Karel Zak --- libblkid/src/partitions/partitions.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libblkid') diff --git a/libblkid/src/partitions/partitions.c b/libblkid/src/partitions/partitions.c index 4138904d4..b5f393b99 100644 --- a/libblkid/src/partitions/partitions.c +++ b/libblkid/src/partitions/partitions.c @@ -22,6 +22,7 @@ #include "partitions.h" #include "sysfs.h" +#include "strutils.h" /** * SECTION: partitions @@ -1109,7 +1110,7 @@ int blkid_parttable_set_id(blkid_parttable tab, const unsigned char *id) if (!tab) return -1; - strncpy(tab->id, (const char *) id, sizeof(tab->id)); + xstrncpy(tab->id, (const char *) id, sizeof(tab->id)); return 0; } -- cgit v1.2.3-55-g7522