Skip to content

Commit

Permalink
handle int overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-shim committed Mar 19, 2024
1 parent b88f03c commit b02b712
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/auth/authenticator.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (*authenticator) AuthenticateBlobRequest(header core.BlobAuthHeader) error
sig := header.AuthenticationData

// Ensure the signature is 65 bytes (Recovery ID is the last byte)
if sig == nil || len(sig) != 65 {
if len(sig) != 65 {
return fmt.Errorf("signature length is unexpected: %d", len(sig))
}

Expand Down
2 changes: 1 addition & 1 deletion core/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type BlobRequestHeader struct {
}

func (sp *SecurityParam) Validate() error {
if sp.ConfirmationThreshold < sp.AdversaryThreshold+10 {
if sp.ConfirmationThreshold < sp.AdversaryThreshold || sp.ConfirmationThreshold-sp.AdversaryThreshold < 10 {
return errors.New("invalid request: quorum threshold must be >= 10 + adversary threshold")
}
if sp.ConfirmationThreshold > 100 {
Expand Down

0 comments on commit b02b712

Please sign in to comment.