Skip to content

Commit c6ac249

Browse files
Li Yao DongLi Yao Dong
Li Yao Dong
authored and
Li Yao Dong
committed
fix: possible panic case if ios payment callback comes from unauthorised party
1 parent 1e659e4 commit c6ac249

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

appstore/cert.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ func (c *Cert) extractCertByIndex(tokenStr string, index int) ([]byte, error) {
5252
if err != nil {
5353
return nil, err
5454
}
55-
55+
if len(header.X5c) <= 0 || index >= len(header.X5c) {
56+
return nil, errors.New("failed to extract cert from x5c header, possible unauthorised request detected")
57+
}
5658
certByte, err := base64.StdEncoding.DecodeString(header.X5c[index])
5759
if err != nil {
5860
return nil, err

0 commit comments

Comments
 (0)