|
|
3cf992 |
From 575ba6e90f005cefb8b1100169a024083d8b4a4a Mon Sep 17 00:00:00 2001
|
|
|
3cf992 |
Message-Id: <575ba6e90f005cefb8b1100169a024083d8b4a4a@dist-git>
|
|
|
3cf992 |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
3cf992 |
Date: Mon, 8 Mar 2021 12:57:36 +0100
|
|
|
3cf992 |
Subject: [PATCH] virDevMapperGetTargetsImpl: Use correct length when copying
|
|
|
3cf992 |
into dm.name
|
|
|
3cf992 |
MIME-Version: 1.0
|
|
|
3cf992 |
Content-Type: text/plain; charset=UTF-8
|
|
|
3cf992 |
Content-Transfer-Encoding: 8bit
|
|
|
3cf992 |
|
|
|
3cf992 |
For reasons unknown, when rewriting this code and dropping
|
|
|
3cf992 |
libdevmapper I've mistakenly used incorrect length of dm.name. In
|
|
|
3cf992 |
linux/dm-ioctl.h the dm_ioctl struct is defined as follows:
|
|
|
3cf992 |
|
|
|
3cf992 |
#define DM_NAME_LEN 128
|
|
|
3cf992 |
|
|
|
3cf992 |
struct dm_ioctl {
|
|
|
3cf992 |
...
|
|
|
3cf992 |
char name[DM_NAME_LEN]; /* device name */
|
|
|
3cf992 |
...
|
|
|
3cf992 |
};
|
|
|
3cf992 |
|
|
|
3cf992 |
However, when copying string into this member, DM_TABLE_DEPS was
|
|
|
3cf992 |
used, which is defined as follows:
|
|
|
3cf992 |
|
|
|
3cf992 |
#define DM_TABLE_DEPS _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, struct dm_ioctl)
|
|
|
3cf992 |
|
|
|
3cf992 |
After decryption, this results in the following size: 3241737483.
|
|
|
3cf992 |
|
|
|
3cf992 |
Fixes: 22494556542c676d1b9e7f1c1f2ea13ac17e1e3e
|
|
|
3cf992 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
3cf992 |
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
3cf992 |
(cherry picked from commit 4f30c1bb8c32374c62f90abb5aa224611c59c363)
|
|
|
3cf992 |
|
|
|
3cf992 |
Conflicts:
|
|
|
3cf992 |
- src/util/virdevmapper.c: The same story as a few commits ago:
|
|
|
3cf992 |
virStrcpy() returns a pointer, but the cherry picked commit
|
|
|
3cf992 |
expects integer.
|
|
|
3cf992 |
|
|
|
3cf992 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1933557
|
|
|
3cf992 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
3cf992 |
Message-Id: <f97200b6dcef39effa380e7e6ea43e8ee02f6b61.1615203117.git.mprivozn@redhat.com>
|
|
|
3cf992 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
3cf992 |
---
|
|
|
3cf992 |
src/util/virdevmapper.c | 2 +-
|
|
|
3cf992 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
3cf992 |
|
|
|
3cf992 |
diff --git a/src/util/virdevmapper.c b/src/util/virdevmapper.c
|
|
|
3cf992 |
index 4994b4caef..dcb3c08df5 100644
|
|
|
3cf992 |
--- a/src/util/virdevmapper.c
|
|
|
3cf992 |
+++ b/src/util/virdevmapper.c
|
|
|
3cf992 |
@@ -257,7 +257,7 @@ virDevMapperGetTargetsImpl(int controlFD,
|
|
|
3cf992 |
if (!(sanitizedPath = virDMSanitizepath(path)))
|
|
|
3cf992 |
return 0;
|
|
|
3cf992 |
|
|
|
3cf992 |
- if (virStrcpy(dm.name, sanitizedPath, DM_TABLE_DEPS) == NULL) {
|
|
|
3cf992 |
+ if (virStrcpy(dm.name, sanitizedPath, DM_NAME_LEN) == NULL) {
|
|
|
3cf992 |
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
|
|
3cf992 |
_("Resolved device mapper name too long"));
|
|
|
3cf992 |
return -1;
|
|
|
3cf992 |
--
|
|
|
3cf992 |
2.31.0
|
|
|
3cf992 |
|