URL: https://github.com/SSSD/sssd/pull/273
Author: fidencio
 Title: #273: CACHE_REQ_SEARCH: Avoid using of unitialized value
Action: opened

PR body:
"""
This issue was introduced by commit 4ef0b19a and may lead to use of
unitialized "req".

In order to fix the issue, let's just allocate tmp_ctx after req is
already set.

The issue was caught by the internal coverity instance.

Related:
https://pagure.io/SSSD/sssd/issue/3362

Signed-off-by: Fabiano FidĂȘncio <[email protected]>
"""

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/273/head:pr273
git checkout pr273
From d894ea42222c058e8e2bfd91915fc5195c94210a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <[email protected]>
Date: Mon, 15 May 2017 11:54:00 +0200
Subject: [PATCH] CACHE_REQ_SEARCH: Avoid using of unitialized value
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This issue was introduced by commit 4ef0b19a and may lead to use of
unitialized "req".

In order to fix the issue, let's just allocate tmp_ctx after req is
already set.

The issue was caught by the internal coverity instance.

Related:
https://pagure.io/SSSD/sssd/issue/3362

Signed-off-by: Fabiano FidĂȘncio <[email protected]>
---
 src/responder/common/cache_req/cache_req_search.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/responder/common/cache_req/cache_req_search.c b/src/responder/common/cache_req/cache_req_search.c
index 793dbc5..70448a7 100644
--- a/src/responder/common/cache_req/cache_req_search.c
+++ b/src/responder/common/cache_req/cache_req_search.c
@@ -425,18 +425,18 @@ static void cache_req_search_done(struct tevent_req *subreq)
     struct ldb_result *result = NULL;
     errno_t ret;
 
-    tmp_ctx = talloc_new(NULL);
-    if (tmp_ctx == NULL) {
-        ret = ENOMEM;
-        goto done;
-    }
-
     req = tevent_req_callback_data(subreq, struct tevent_req);
     state = tevent_req_data(req, struct cache_req_search_state);
 
     state->dp_success = state->cr->plugin->dp_recv_fn(subreq, state->cr);
     talloc_zfree(subreq);
 
+    tmp_ctx = talloc_new(NULL);
+    if (tmp_ctx == NULL) {
+        ret = ENOMEM;
+        goto done;
+    }
+
     /* Get result from cache again. */
     ret = cache_req_search_cache(tmp_ctx, state->cr, &result);
     if (ret != EOK) {
_______________________________________________
sssd-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to