device-mapper-multipath/0009-libmultipath-_install_keyword-cleanup.patch
Benjamin Marzinski 996407fc5f device-mapper-multipath-0.7.7-7.gitb80318b
Update Source to latest upstream commit
Rename files
  * Previous patches 0001-0020 are now patches 0002-0021
  * Previous patches 0021-0028 are now patches 0026-0033
Add 0001-kpartx-Use-absolute-paths-to-create-mappings.patch
Add 0022-multipathd-check-for-NULL-udevice-in-cli_add_path.patch
Add 0023-libmultipath-remove-max_fds-code-duplication.patch
Add 0024-multipathd-set-return-code-for-multipathd-commands.patch
Add 0025-mpathpersist-fix-registration-rollback-issue.patch
  * The above 5 patches have been submitted upstream
2018-10-10 00:16:58 -05:00

43 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 27 Jul 2018 18:01:14 -0500
Subject: [PATCH] libmultipath: _install_keyword cleanup
_install_keyword should use VECTOR_LAST_SLOT(), which has better error
checking. It should also fail if it gets a NULL pointer, instead of
dereferencing it. Found by coverity.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/parser.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
index b8b7e0d..92ef7cf 100644
--- a/libmultipath/parser.c
+++ b/libmultipath/parser.c
@@ -79,12 +79,16 @@ _install_keyword(vector keywords, char *string,
struct keyword *keyword;
/* fetch last keyword */
- keyword = VECTOR_SLOT(keywords, VECTOR_SIZE(keywords) - 1);
+ keyword = VECTOR_LAST_SLOT(keywords);
+ if (!keyword)
+ return 1;
/* position to last sub level */
- for (i = 0; i < sublevel; i++)
- keyword =
- VECTOR_SLOT(keyword->sub, VECTOR_SIZE(keyword->sub) - 1);
+ for (i = 0; i < sublevel; i++) {
+ keyword = VECTOR_LAST_SLOT(keyword->sub);
+ if (!keyword)
+ return 1;
+ }
/* First sub level allocation */
if (!keyword->sub)
--
2.7.4