From e30f1ad7bd3443cbd354f86a6fb6301742a2c95a Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Mon, 10 Feb 2025 08:35:13 -0800 Subject: [PATCH] Fix nil pointer deref in PeerPolicyMappingHandler (#20913) The following lines will attempt to de-reference the nil value. Instead just return the error at once. --- cmd/site-replication.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/site-replication.go b/cmd/site-replication.go index 728dc80b0..642d4eb37 100644 --- a/cmd/site-replication.go +++ b/cmd/site-replication.go @@ -1441,7 +1441,7 @@ func (c *SiteReplicationSys) PeerPolicyMappingHandler(ctx context.Context, mappi if foundGroupDN, underBaseDN, err = globalIAMSys.LDAPConfig.GetValidatedGroupDN(nil, entityName); err != nil { iamLogIf(ctx, err) } else if foundGroupDN == nil || !underBaseDN { - err = errNoSuchGroup + return wrapSRErr(errNoSuchGroup) } entityName = foundGroupDN.NormDN } else { @@ -1449,7 +1449,7 @@ func (c *SiteReplicationSys) PeerPolicyMappingHandler(ctx context.Context, mappi if foundUserDN, err = globalIAMSys.LDAPConfig.GetValidatedDNForUsername(entityName); err != nil { iamLogIf(ctx, err) } else if foundUserDN == nil { - err = errNoSuchUser + return wrapSRErr(errNoSuchUser) } entityName = foundUserDN.NormDN }