Merge pull request 'Check solution length in validate challenge' (#36) from bugfix into master
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

Reviewed-on: #36
This commit is contained in:
erinn 2021-05-13 13:01:23 -07:00
commit 7f8b475fd7
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[:])