On (04/04/14 14:28), Michal Židek wrote:
Reported by Clang.
This is probably false positive, because if state->nmaps is 0
in ipa_get_selinux_recv() then state->selinuxmaps will
probaly always be NULL, so this patch just ensures it will
always be the case.
Patch is attached.
Michal
From 16287c64308e94a24c6ace9358fb501b393ad77a Mon Sep 17 00:00:00
2001
From: Michal Zidek <mzidek(a)redhat.com>
Date: Fri, 4 Apr 2014 14:09:24 +0200
Subject: [PATCH] Possible null dereference in SELinux code
---
src/providers/ipa/ipa_selinux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/providers/ipa/ipa_selinux.c b/src/providers/ipa/ipa_selinux.c
index 7c3ce45..e0d7a00 100644
--- a/src/providers/ipa/ipa_selinux.c
+++ b/src/providers/ipa/ipa_selinux.c
@@ -322,7 +322,7 @@ static void ipa_selinux_handler_done(struct tevent_req *req)
goto fail;
}
- if (map_count > 0 && maps != NULL) {
+ if (map_count > 0) {
ret = ipa_save_user_maps(sysdb, op_ctx->ipa_domain, map_count, maps);
if (ret != EOK) {
goto fail;
@@ -1345,7 +1345,7 @@ ipa_get_selinux_recv(struct tevent_req *req,
*default_user = NULL;
}
- if (state->selinuxmaps != NULL) {
+ if (state->selinuxmaps != NULL && state->nmaps != 0) {
*count = state->nmaps;
*maps = talloc_steal(mem_ctx, state->selinuxmaps);
} else {
--
1.7.11.2
patch fixed warning
ACK
LS