File multipath-tools-crash-on-invalid-config-file of Package multipath-tools

commit c78929d6780be2fbc6c14ca8dba19ecb9ad37a7b
Author: Hannes Reinecke <hare@suse.de>
Date:   Thu Mar 19 12:41:49 2009 +0100

    multipath -t crashes on invalid configuration file
    
    When the configuration file is invalid, 'multipath -t' is prone
    to crashing. We really should check for pointer validity in
    hwe_regmatch.
    
    Signed-off-by: Hannes Reinecke <hare@suse.de>

diff --git a/libmultipath/config.c b/libmultipath/config.c
index 66cefd8..4e9f59d 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -68,9 +68,12 @@ hwe_regmatch (struct hwentry *hwe1, struct hwentry *hwe2)
 	    regcomp(&rre, hwe1->revision, REG_EXTENDED|REG_NOSUB))
 		goto out_pre;
 
-	if ((!hwe1->vendor || !regexec(&vre, hwe2->vendor, 0, NULL, 0)) &&
-	    (!hwe1->product || !regexec(&pre, hwe2->product, 0, NULL, 0)) &&
-	    (!hwe1->revision || !regexec(&rre, hwe2->revision, 0, NULL, 0)))
+	if ((!hwe1->vendor || !hwe2->vendor ||
+	     !regexec(&vre, hwe2->vendor, 0, NULL, 0)) &&
+	    (!hwe1->product || !hwe2->product ||
+	     !regexec(&pre, hwe2->product, 0, NULL, 0)) &&
+	    (!hwe1->revision || !hwe2->revision ||
+	     !regexec(&rre, hwe2->revision, 0, NULL, 0)))
 		retval = 0;
 
 	if (hwe1->revision)
openSUSE Build Service is sponsored by