Check solution length in validate challenge
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details

Found by Fuzz Bot.
This commit is contained in:
Sarah Jamie Lewis 2021-05-13 12:37:42 -07:00
parent 7444d1e0cf
commit 770f36afad
1 changed files with 3 additions and 0 deletions

View File

@ -87,6 +87,9 @@ func (powapp *ProofOfWorkApplication) solveChallenge(challenge []byte, prng core
// ValidateChallenge returns true if the message and spamguard pass the challenge
func (powapp *ProofOfWorkApplication) validateChallenge(challenge []byte, solution []byte) bool {
if len(solution) != 32 {
return false
}
solve := make([]byte, len(challenge)+32)
copy(solve[0:], solution[0:32])
copy(solve[32:], challenge[:])