The spec says that SCSI name strings designator length must be a multiple of 4, and that strings must be zero-terminated and zero-padded. Fix the returned string length if the VPD input ends with multiple 0-bytes. Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> --- libmultipath/discovery.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 32e3f9d3..3558e559 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1032,6 +1032,8 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len, vpd += 4; len = vpd_len - 4; + while (len > 2 && vpd[len - 2] == '\0') + --len; if (len > out_len - 1) { condlog(1, "%s: WWID overflow, type 8/%c, %d/%lu bytes required", __func__, out[0], len + 1, out_len); -- 2.21.0 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel