From 82c55f46c9f23a601a8a33f96907ff7a144d0db1 Mon Sep 17 00:00:00 2001 From: Christophe Varoqui Date: Fri, 22 Jan 2010 12:26:39 +0100 Subject: Add checks before use conf->xxx now that they can be null --- libmultipath/dict.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libmultipath/dict.c b/libmultipath/dict.c index ee4de68..45423c6 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -1427,7 +1427,7 @@ snprint_hw_getuid_callout (char * buff, int len, void * data) { struct hwentry * hwe = (struct hwentry *)data; - if (!hwe->getuid) + if (!hwe->getuid || !conf->getuid) return 0; if (strlen(hwe->getuid) == strlen(conf->getuid) && !strcmp(hwe->getuid, conf->getuid)) @@ -1441,7 +1441,7 @@ snprint_hw_prio (char * buff, int len, void * data) { struct hwentry * hwe = (struct hwentry *)data; - if (!hwe->prio_name) + if (!hwe->prio_name || !conf->prio_name) return 0; if (!strcmp(hwe->prio_name, conf->prio_name)) return 0; @@ -1454,7 +1454,7 @@ snprint_hw_features (char * buff, int len, void * data) { struct hwentry * hwe = (struct hwentry *)data; - if (!hwe->features) + if (!hwe->features || !conf->features) return 0; if (strlen(hwe->features) == strlen(conf->features) && !strcmp(hwe->features, conf->features)) @@ -1468,7 +1468,7 @@ snprint_hw_hardware_handler (char * buff, int len, void * data) { struct hwentry * hwe = (struct hwentry *)data; - if (!hwe->hwhandler) + if (!hwe->hwhandler || !conf->hwhandler) return 0; if (strlen(hwe->hwhandler) == strlen(conf->hwhandler) && !strcmp(hwe->hwhandler, conf->hwhandler)) @@ -1482,7 +1482,7 @@ snprint_hw_selector (char * buff, int len, void * data) { struct hwentry * hwe = (struct hwentry *)data; - if (!hwe->selector) + if (!hwe->selector || !conf->selector) return 0; if (strlen(hwe->selector) == strlen(conf->selector) && !strcmp(hwe->selector, conf->selector)) @@ -1498,7 +1498,7 @@ snprint_hw_path_grouping_policy (char * buff, int len, void * data) char str[POLICY_NAME_SIZE]; - if (!hwe->pgpolicy) + if (!hwe->pgpolicy || !conf->pgpolicy) return 0; if (hwe->pgpolicy == conf->pgpolicy) return 0; @@ -1513,7 +1513,7 @@ snprint_hw_failback (char * buff, int len, void * data) { struct hwentry * hwe = (struct hwentry *)data; - if (!hwe->pgfailback) + if (!hwe->pgfailback || !conf->pgfailback) return 0; if (hwe->pgfailback == conf->pgfailback) return 0; @@ -1536,7 +1536,7 @@ snprint_hw_rr_weight (char * buff, int len, void * data) { struct hwentry * hwe = (struct hwentry *)data; - if (!hwe->rr_weight) + if (!hwe->rr_weight || !conf->rr_weight) return 0; if (hwe->rr_weight == conf->rr_weight) return 0; @@ -1623,7 +1623,7 @@ snprint_hw_path_checker (char * buff, int len, void * data) { struct hwentry * hwe = (struct hwentry *)data; - if (!hwe->checker_name) + if (!hwe->checker_name || !conf->checker_name) return 0; if (!strcmp(hwe->checker_name, conf->checker_name)) return 0; -- cgit v1.2.3