[OpenWrt-Devel,fstools,PATCH:,1/4] libblkid-tiny: fix wrong btrfs label length
diff mbox series

Message ID 20190616170050.27126-1-ansuelsmth@gmail.com
State Accepted
Delegated to: John Crispin
Headers show
Series
  • [OpenWrt-Devel,fstools,PATCH:,1/4] libblkid-tiny: fix wrong btrfs label length
Related show

Commit Message

Ansuel Smith June 16, 2019, 5 p.m. UTC
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/libblkid-tiny/btrfs.c b/libblkid-tiny/btrfs.c
index 7ce3dff..cf33db5 100644
--- a/libblkid-tiny/btrfs.c
+++ b/libblkid-tiny/btrfs.c
@@ -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");