From 60c49c1692e2cf2baa82ab7e9ae202fc205fda1d Mon Sep 17 00:00:00 2001 From: Lars Seipel Date: Mon, 4 Dec 2023 19:32:33 +0100 Subject: [PATCH] outposts/ldap: avoid nil ptr deref in MemorySearcher (#7767) --- internal/outpost/ldap/search/memory/memory.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/outpost/ldap/search/memory/memory.go b/internal/outpost/ldap/search/memory/memory.go index 2b80bbbbb..198739122 100644 --- a/internal/outpost/ldap/search/memory/memory.go +++ b/internal/outpost/ldap/search/memory/memory.go @@ -147,7 +147,11 @@ func (ms *MemorySearcher) Search(req *search.Request) (ldap.ServerSearchResult, fg := api.NewGroup(g.Pk, g.NumPk, g.Name, g.ParentName, []api.GroupMember{u}, []api.Role{}) fg.SetUsers([]int32{flag.UserPk}) if g.Parent.IsSet() { - fg.SetParent(*g.Parent.Get()) + if p := g.Parent.Get(); p != nil { + fg.SetParent(*p) + } else { + fg.SetParentNil() + } } fg.SetAttributes(g.Attributes) fg.SetIsSuperuser(*g.IsSuperuser)