Blame SOURCES/0052-libmultipath-check-for-null-wwid-before-strcmp.patch

a5a7cf
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
a5a7cf
From: Benjamin Marzinski <bmarzins@redhat.com>
a5a7cf
Date: Mon, 4 Jan 2021 21:59:54 -0600
a5a7cf
Subject: [PATCH] libmultipath: check for null wwid before strcmp
a5a7cf
a5a7cf
Commit 749aabd0 (libmultipath: ignore multipaths sections without wwid
a5a7cf
option) removed all mpentries with a NULL wwid, but didn't stop strcmp()
a5a7cf
from being run on them in merge_mptable(). The result of strcmp() with
a5a7cf
a NULL parameter is undefined, so fix that.
a5a7cf
a5a7cf
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
a5a7cf
a5a7cf
Reviewed-by: Martin Wilck <mwilck@suse.com>
a5a7cf
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
a5a7cf
---
a5a7cf
 libmultipath/config.c | 2 +-
a5a7cf
 1 file changed, 1 insertion(+), 1 deletion(-)
a5a7cf
a5a7cf
diff --git a/libmultipath/config.c b/libmultipath/config.c
a5a7cf
index dc81c994..dd645f17 100644
a5a7cf
--- a/libmultipath/config.c
a5a7cf
+++ b/libmultipath/config.c
a5a7cf
@@ -453,7 +453,7 @@ void merge_mptable(vector mptable)
a5a7cf
 		}
a5a7cf
 		j = i + 1;
a5a7cf
 		vector_foreach_slot_after(mptable, mp2, j) {
a5a7cf
-			if (strcmp(mp1->wwid, mp2->wwid))
a5a7cf
+			if (!mp2->wwid || strcmp(mp1->wwid, mp2->wwid))
a5a7cf
 				continue;
a5a7cf
 			condlog(1, "%s: duplicate multipath config section for %s",
a5a7cf
 				__func__, mp1->wwid);
a5a7cf
-- 
a5a7cf
2.17.2
a5a7cf