Browse Source
Check for valid checksum (#20878)
Add a few safety measures for checksums.
pull/20881/head
Klaus Post
6 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
4 additions and
2 deletions
-
cmd/utils.go
|
|
@ -271,10 +271,12 @@ func validateLengthAndChecksum(r *http.Request) bool { |
|
|
|
if err != nil { |
|
|
|
return false |
|
|
|
} |
|
|
|
if !cs.Type.IsSet() { |
|
|
|
if cs == nil || !cs.Type.IsSet() { |
|
|
|
return false |
|
|
|
} |
|
|
|
r.Body = hash.NewChecker(r.Body, cs.Type.Hasher(), cs.Raw, r.ContentLength) |
|
|
|
if cs.Valid() && !cs.Type.Trailing() { |
|
|
|
r.Body = hash.NewChecker(r.Body, cs.Type.Hasher(), cs.Raw, r.ContentLength) |
|
|
|
} |
|
|
|
return true |
|
|
|
} |
|
|
|
|
|
|
|