~edwargix/tallyard

184f44dd00b6b82ce2b684d95772538bf206d8a3 — David Florness 3 years ago db0590e
Don't allow zero for inputs
1 files changed, 6 insertions(+), 0 deletions(-)

M election/msg.go
M election/msg.go => election/msg.go +6 -0
@@ 243,6 243,12 @@ func (elections *ElectionsMap) onJoinElectionMessage(evt *event.Event) (success 
	}
	input := new(big.Int).SetBytes(bytes)

	// zero is not allowed
	if input.Cmp(new(big.Int)) == 0 {
		warnf("their input is zero")
		return
	}

	bytes, err = base64.StdEncoding.DecodeString(content.PubKey)
	if err != nil {
		warnf("we couldn't decode their public key: %s", err)