libblkid-tiny: fix wrong btrfs label length
authorAnsuel Smith <ansuelsmth@gmail.com>
Sun, 16 Jun 2019 17:00:47 +0000 (19:00 +0200)
committerJohn Crispin <john@phrozen.org>
Mon, 1 Jul 2019 13:53:02 +0000 (15:53 +0200)
Btrfs label length is 256 included the termination char ( '\0' ) as the real max length is 255 (less than 256 from the wiki).

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
libblkid-tiny/btrfs.c

index 7ce3dfff86d643ca52a3fb917a09a4b30606ba2f..cf33db51009e07dcb20a53d6dbe31ffd6b9fe18e 100644 (file)
@@ -70,7 +70,7 @@ static int probe_btrfs(blkid_probe pr, const struct blkid_idmag *mag)
        if (*bfs->label)
                blkid_probe_set_label(pr,
                                (unsigned char *) bfs->label,
-                               sizeof(bfs->label));
+                               sizeof(bfs->label) - 1);
 
        blkid_probe_set_uuid(pr, bfs->fsid);
        blkid_probe_set_uuid_as(pr, bfs->dev_item.uuid, "UUID_SUB");