From 184f44dd00b6b82ce2b684d95772538bf206d8a3 Mon Sep 17 00:00:00 2001 From: David Florness Date: Sat, 27 Mar 2021 17:25:17 -0400 Subject: [PATCH] Don't allow zero for inputs --- election/msg.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/election/msg.go b/election/msg.go index 918a3f2..bff3d4e 100644 --- a/election/msg.go +++ b/election/msg.go @@ -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) -- 2.38.4