mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
virDevMapperGetTargetsImpl: Use correct length when copying into dm.name
For reasons unknown, when rewriting this code and dropping
libdevmapper I've mistakenly used incorrect length of dm.name. In
linux/dm-ioctl.h the dm_ioctl struct is defined as follows:
#define DM_NAME_LEN 128
struct dm_ioctl {
...
char name[DM_NAME_LEN]; /* device name */
...
};
However, when copying string into this member, DM_TABLE_DEPS was
used, which is defined as follows:
#define DM_TABLE_DEPS _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, struct dm_ioctl)
After decryption, this results in the following size: 3241737483.
Fixes: 2249455654
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
d5b2644815
commit
4f30c1bb8c
@ -240,7 +240,7 @@ virDevMapperGetTargetsImpl(int controlFD,
|
||||
if (!(sanitizedPath = virDMSanitizepath(path)))
|
||||
return 0;
|
||||
|
||||
if (virStrcpy(dm.name, sanitizedPath, DM_TABLE_DEPS) < 0) {
|
||||
if (virStrcpy(dm.name, sanitizedPath, DM_NAME_LEN) < 0) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("Resolved device mapper name too long"));
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user