Skip to content

Commit 4ddc069

Browse files
authored
Check bounds of tpm.EKs() slice before indexing (#47669)
1 parent b6fa860 commit 4ddc069

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/tpm/tpm.go

+5
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ func QueryWithTPM(
125125
if err != nil {
126126
return nil, trace.Wrap(err, "querying EKs")
127127
}
128+
// Be a good citizen and check the slice bounds. This is not expected to
129+
// happen.
130+
if len(eks) == 0 {
131+
return nil, trace.BadParameter("no endorsement keys found in tpm")
132+
}
128133

129134
// The first EK returned by `go-attestation` will be an RSA based EK key or
130135
// EK cert. On Windows, ECC certs may also be returned following this. At

0 commit comments

Comments
 (0)