From c2a92cd351a48e0cdfd4902f0dd20a5e6e6ac46d Mon Sep 17 00:00:00 2001 From: Eugene R Date: Thu, 2 Dec 2021 15:23:41 +0200 Subject: [PATCH] Fix possible nil pointer dereference (#13318) --- changelog/13318.txt | 3 +++ vault/identity_store.go | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelog/13318.txt diff --git a/changelog/13318.txt b/changelog/13318.txt new file mode 100644 index 000000000..79ddb15ec --- /dev/null +++ b/changelog/13318.txt @@ -0,0 +1,3 @@ +```release-note:bug +identity: Fix possible nil pointer dereference. +``` diff --git a/vault/identity_store.go b/vault/identity_store.go index 7f9343160..f948771fc 100644 --- a/vault/identity_store.go +++ b/vault/identity_store.go @@ -250,8 +250,9 @@ func (i *IdentityStore) Invalidate(ctx context.Context, key string) { // storage entry is non-nil, its an indication of an update. In this // case, entities in the updated bucket needs to be reinserted into // MemDB. - entityIDs := make([]string, 0, len(bucket.Items)) + var entityIDs []string if bucket != nil { + entityIDs = make([]string, 0, len(bucket.Items)) for _, item := range bucket.Items { entity, err := i.parseEntityFromBucketItem(ctx, item) if err != nil {