]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: use xstrncpy() for PT id [coverity scan]
authorKarel Zak <kzak@redhat.com>
Wed, 25 Jul 2018 09:25:33 +0000 (11:25 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 25 Jul 2018 09:25:33 +0000 (11:25 +0200)
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 <kzak@redhat.com>
libblkid/src/partitions/partitions.c

index 4138904d44ed0f459bfb8513cf4fd5e1e1499a65..b5f393b99c97e8bd798831ea922c793181cf2201 100644 (file)
@@ -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;
 }