Fixed whisper pub key bug

* Unrecoverable messages would cause segfault when recovering invalid
  pub key
This commit is contained in:
obscuren 2015-01-30 13:24:20 +01:00
parent 54927dc0e0
commit c48644490f
2 changed files with 2 additions and 2 deletions

View File

@ -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)

View File

@ -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
} }