[SSSD] [PATCH] Fix possible dereference of a NULL pointer

Lukas Slebodnik lslebodn at redhat.com
Tue Jul 23 14:11:42 UTC 2013


ehlo,

This issue was found by scan-build.

We check if function ipa_get_ad_id_ctx returns NULL,
but function ipa_get_ad_id_ctx could never return NULL.

Patch is attached.

LS
-------------- next part --------------
>From 7dc54003b7acaa466a14cef6d8d764e86670ecc0 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 23 Jul 2013 16:04:02 +0200
Subject: [PATCH] Fix possible dereference of a NULL pointer.

We check if function ipa_get_ad_id_ctx returns NULL,
but function ipa_get_ad_id_ctx could never return NULL.
This issue was found by scan-build.
---
 src/providers/ipa/ipa_subdomains_id.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/providers/ipa/ipa_subdomains_id.c b/src/providers/ipa/ipa_subdomains_id.c
index 6bf97bec0df465ba206181ec59789c0567443432..c380d159e7ae1c23b9fcebcaba139168a275f81c 100644
--- a/src/providers/ipa/ipa_subdomains_id.c
+++ b/src/providers/ipa/ipa_subdomains_id.c
@@ -335,7 +335,7 @@ ipa_get_ad_id_ctx(struct ipa_id_ctx *ipa_ctx,
         if (iter->dom == dom) break;
     }
 
-    return iter->ad_id_ctx;
+    return (iter) ? iter->ad_id_ctx : NULL;
 }
 
 static void
-- 
1.8.3.1



More information about the sssd-devel mailing list