Blame SOURCES/0012-ifp-fix-original-fix-use-after-free.patch

8ad293
From 3b158934cbb8f87cbfaf1650389b8dcd654b92ca Mon Sep 17 00:00:00 2001
8ad293
From: Sumit Bose <sbose@redhat.com>
8ad293
Date: Thu, 19 Nov 2020 18:05:00 +0100
8ad293
Subject: [PATCH] ifp: fix original fix use-after-free
8ad293
8ad293
The original fix stole the fqdn too earlier. Only for SSS_DP_USER
8ad293
requests the steal is important. For other request where the first
8ad293
result is returned to the caller the original version
8ad293
might even cause issues since the name does not belong to the memory
8ad293
hierarchy of the result anymore.
8ad293
8ad293
Resolves: https://github.com/SSSD/sssd/issues/5382
8ad293
8ad293
Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
8ad293
---
8ad293
 src/responder/ifp/ifpsrv_cmd.c | 4 ++--
8ad293
 1 file changed, 2 insertions(+), 2 deletions(-)
8ad293
8ad293
diff --git a/src/responder/ifp/ifpsrv_cmd.c b/src/responder/ifp/ifpsrv_cmd.c
8ad293
index d95618127..8cf1ec84c 100644
8ad293
--- a/src/responder/ifp/ifpsrv_cmd.c
8ad293
+++ b/src/responder/ifp/ifpsrv_cmd.c
8ad293
@@ -128,10 +128,10 @@ static void ifp_user_get_attr_done(struct tevent_req *subreq)
8ad293
         tevent_req_error(req, ERR_INTERNAL);
8ad293
         return;
8ad293
     }
8ad293
-    fqdn = talloc_steal(state, fqdn);
8ad293
 
8ad293
     if (state->search_type == SSS_DP_USER) {
8ad293
-        /* throw away the result and perform attr search */
8ad293
+        /* throw away the result but keep the fqdn and perform attr search */
8ad293
+        fqdn = talloc_steal(state, fqdn);
8ad293
         talloc_zfree(state->res);
8ad293
 
8ad293
         ret = sysdb_get_user_attr_with_views(state, state->dom, fqdn,
8ad293
-- 
8ad293
2.21.3
8ad293