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

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