Add length check to labeled hash parsing
This commit is contained in:
parent
3aee3486af
commit
34112e32ec
1 changed files with 4 additions and 0 deletions
|
@ -50,6 +50,10 @@ func Load(labeledHash []byte) (*LabeledHash, error) {
|
|||
return nil, errors.New("compatibility error: invalid or unsupported algorithm")
|
||||
}
|
||||
|
||||
if alg.new().Size() != len(digest) {
|
||||
return nil, errors.New("integrity error: invalid digest length")
|
||||
}
|
||||
|
||||
return &LabeledHash{
|
||||
alg: alg,
|
||||
digest: digest,
|
||||
|
|
Loading…
Add table
Reference in a new issue