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

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