Skip to content

Commit

Permalink
Fix segfault in expiration unit tests
Browse files Browse the repository at this point in the history
TestExpiration_Tidy was passing in a leaseEntry that had a nil Secret,
which then caused a segfault as the changes to revokeEntry didn't check
whether Secret was nil; this is probably unlikely to occur in real life,
but good to be extra cautious.
  • Loading branch information
joelthompson committed Aug 28, 2018
1 parent 959c478 commit 511a89d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion vault/expiration.go
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,12 @@ func (m *ExpirationManager) revokeEntry(ctx context.Context, le *leaseEntry) err
return nil
}

le.Secret.IssueTime = le.IssueTime
if le.Secret != nil {
// not sure if this is really valid to have a leaseEntry with a nil Secret
// (if there's a nil Secret, what are you really leasing?), but the tests
// create one, and good to be defensive
le.Secret.IssueTime = le.IssueTime
}

// Handle standard revocation via backends
resp, err := m.router.Route(m.quitContext, logical.RevokeRequest(le.Path, le.Secret, le.Data))
Expand Down

0 comments on commit 511a89d

Please sign in to comment.