Fixed whisper pub key bug

* Unrecoverable messages would cause segfault when recovering invalid
  pub key
pull/272/merge
obscuren 10 years ago
parent 54927dc0e0
commit c48644490f
  1. 2
      crypto/crypto.go
  2. 2
      whisper/whisper.go

@ -92,7 +92,7 @@ func ToECDSAPub(pub []byte) *ecdsa.PublicKey {
} }
func FromECDSAPub(pub *ecdsa.PublicKey) []byte { func FromECDSAPub(pub *ecdsa.PublicKey) []byte {
if pub == nil { if pub == nil || pub.X == nil || pub.Y == nil {
return nil return nil
} }
return elliptic.Marshal(S256(), pub.X, pub.Y) return elliptic.Marshal(S256(), pub.X, pub.Y)

@ -197,7 +197,7 @@ func (self *Whisper) add(envelope *Envelope) error {
go self.postEvent(envelope) go self.postEvent(envelope)
} }
wlogger.DebugDetailln("added whisper message") wlogger.DebugDetailf("added whisper envelope %x\n", envelope)
return nil return nil
} }

Loading…
Cancel
Save