From ed4e64f6b22fa3f52913b07d2150feb8d9e8976d Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Fri, 19 Jul 2019 13:48:11 +0200 Subject: [PATCH] Fixed nil check for token (#6179) I can only assume we want to check for the retrieved `updatedToken` to not be nil, before accessing it below. `token` can't possibly be nil at this point, as we accessed `token.AccessorID` just before. --- agent/consul/acl_endpoint.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/consul/acl_endpoint.go b/agent/consul/acl_endpoint.go index e7def76fb0..fda4b302a9 100644 --- a/agent/consul/acl_endpoint.go +++ b/agent/consul/acl_endpoint.go @@ -602,7 +602,7 @@ func (a *ACL) tokenSetInternal(args *structs.ACLTokenSetRequest, reply *structs. } // Don't check expiration times here as it doesn't really matter. - if _, updatedToken, err := a.srv.fsm.State().ACLTokenGetByAccessor(nil, token.AccessorID); err == nil && token != nil { + if _, updatedToken, err := a.srv.fsm.State().ACLTokenGetByAccessor(nil, token.AccessorID); err == nil && updatedToken != nil { *reply = *updatedToken } else { return fmt.Errorf("Failed to retrieve the token after insertion")