|
|
71e593 |
From 4a9c9aa6dcfa09ca9ff24b7d22a37f2fdba4ee3f Mon Sep 17 00:00:00 2001
|
|
|
71e593 |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
71e593 |
Date: Tue, 16 Oct 2018 10:42:43 +0200
|
|
|
71e593 |
Subject: [PATCH 57/57] UTIL: Suppress Coverity warning
|
|
|
71e593 |
|
|
|
71e593 |
We recently added this code:
|
|
|
71e593 |
if (domain_name != NULL
|
|
|
71e593 |
&& is_files_provider(find_domain_by_name(dom,
|
|
|
71e593 |
domain_name,
|
|
|
71e593 |
false)))
|
|
|
71e593 |
|
|
|
71e593 |
find_domain_by_name returns NULL if the domain_name can't be found. This
|
|
|
71e593 |
of course makes mostly sense for trusted domains that can appear and
|
|
|
71e593 |
disappear. And is_files_provider() didn't handle the situation where the
|
|
|
71e593 |
domain pointer was NULL and would directly dereference it.
|
|
|
71e593 |
|
|
|
71e593 |
This commit just adds a NULL check for the domain pointer so that
|
|
|
71e593 |
is_files_provider() returns 'false' if the domain pointer was NULL.
|
|
|
71e593 |
|
|
|
71e593 |
Another alternative might be to check the return value of
|
|
|
71e593 |
find_domain_by_name(), but I don't think it's worth the trouble.
|
|
|
71e593 |
|
|
|
71e593 |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
71e593 |
---
|
|
|
71e593 |
src/util/domain_info_utils.c | 3 ++-
|
|
|
71e593 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
71e593 |
|
|
|
71e593 |
diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c
|
|
|
71e593 |
index 8bef6c9af382ad55e14368b76dd4af7a53ea809b..ffb8cdf102c3ef92b4e8059d846f6b15b835ce69 100644
|
|
|
71e593 |
--- a/src/util/domain_info_utils.c
|
|
|
71e593 |
+++ b/src/util/domain_info_utils.c
|
|
|
71e593 |
@@ -931,6 +931,7 @@ bool sss_domain_info_get_output_fqnames(struct sss_domain_info *domain)
|
|
|
71e593 |
|
|
|
71e593 |
bool is_files_provider(struct sss_domain_info *domain)
|
|
|
71e593 |
{
|
|
|
71e593 |
- return domain->provider != NULL &&
|
|
|
71e593 |
+ return domain != NULL &&
|
|
|
71e593 |
+ domain->provider != NULL &&
|
|
|
71e593 |
strcasecmp(domain->provider, "files") == 0;
|
|
|
71e593 |
}
|
|
|
71e593 |
--
|
|
|
71e593 |
2.14.4
|
|
|
71e593 |
|