Skip to content

Commit

Permalink
FIX: AcceptProof of rmcbox was able to overwrite an already completed…
Browse files Browse the repository at this point in the history
… proof, which could further make proof.Marshal panic.
  • Loading branch information
fixxxedpoint committed Jun 17, 2020
1 parent 014cb41 commit 18a8015
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/rmcbox/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,24 @@ func (ins *instance) AcceptProof(r io.Reader) error {
if ins.stat == Unknown {
return errors.New("cannot accept proof of unknown data")
}
data := make([]byte, ins.proof.MarshaledLength())
nProc := uint16(ins.keys.Length())
proof := multi.NewSignature(crypto.MinimalQuorum(nProc), ins.signedData)
data := make([]byte, proof.MarshaledLength())
_, err := io.ReadFull(r, data)
if err != nil {
return err
}
_, err = ins.proof.Unmarshal(data)
_, err = proof.Unmarshal(data)
if err != nil {
return err
}
if !ins.keys.MultiVerify(ins.proof) {
if !ins.keys.MultiVerify(proof) {
return errors.New("wrong multisignature")
}
ins.stat = Finished
if ins.stat != Finished {
ins.proof = proof
ins.stat = Finished
}
return nil
}

Expand Down

0 comments on commit 18a8015

Please sign in to comment.