Check solution length in validate challenge #36

Merged
erinn merged 1 commits from bugfix into master 2021-05-13 20:01:24 +00:00
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[:])