commit 69c9c7b9f0759ba2c31afe74575fd262d9b5a0fd from: Benjamin Stürz date: Mon May 15 21:55:10 2023 UTC Allow drive names longer than sd0, like vnd0 commit - 7c38b724e9cf37eda0a682776bf255a2fecca043 commit + 69c9c7b9f0759ba2c31afe74575fd262d9b5a0fd blob - 6ea37c84af0cea4280740df6659015248522108c blob + 1d6996558b3dacfbf455d78de18ef399f0f1fb09 --- lsblk.c +++ lsblk.c @@ -153,7 +153,7 @@ struct my_partinfo { struct my_diskinfo { char type[16]; char label[16]; - char name[4]; + char name[8]; uint64_t size; uint64_t used; u_char duid[8]; @@ -377,12 +377,11 @@ static struct my_diskinfo read_disk (const char *name) letter = ppath + len - 1; } - memcpy (disk.name, name, 3); - disk.name[3] = '\0'; - disk.size = DL_GETDSIZE (&label) * label.d_secsize; - memcpy (disk.type, label.d_typename, 16); + strlcpy (disk.name, name, sizeof disk.name); + disk.size = DL_GETDSIZE (&label) * label.d_secsize; + memcpy (disk.type, label.d_typename, sizeof disk.type); stripdisk (disk.type); - memcpy (disk.label, label.d_packname, 16); + memcpy (disk.label, label.d_packname, sizeof disk.label); memcpy (disk.duid, label.d_uid, sizeof disk.duid); disk.num_parts = 0;