libmultipath: fix parsing of SCSI name string, iqn format
authorMartin Wilck <mwilck@suse.com>
Mon, 24 Jun 2019 09:27:44 +0000 (11:27 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Wed, 3 Jul 2019 06:31:31 +0000 (08:31 +0200)
Do not overwrite the leading '8'.

Signed-off-by: Martin Wilck <mwilck@suse.com>
libmultipath/discovery.c

index 10306b2..45c2931 100644 (file)
@@ -1037,12 +1037,11 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
                                }
                        } else {
                                out[0] = '8';
-                               len = 1;
                                vpd += 4;
                                vpd_len -= 4;
                                if (vpd_len > out_len - 2)
                                        vpd_len = out_len - 2;
-                               memcpy(out, vpd, vpd_len);
+                               memcpy(out + 1, vpd, vpd_len);
                                len = vpd_len + 1;
                                out[len] = '\0';
                        }