Fix integer overflow in digest parsing (#211)

This commit is contained in:
Brandon Weeks 2021-04-13 15:57:16 -07:00 committed by GitHub
parent b89180c3eb
commit 31ad4f57fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -712,7 +712,7 @@ func parseRawEvent2(r *bytes.Buffer, specID *specIDEvent) (event rawEvent, err e
if alg.ID != algID {
continue
}
if uint16(r.Len()) < alg.Size {
if r.Len() < int(alg.Size) {
return event, fmt.Errorf("reading digest: %v", io.ErrUnexpectedEOF)
}
digest.data = make([]byte, alg.Size)