diff --git a/p2p/conn/secret_connection.go b/p2p/conn/secret_connection.go index 7f9061440..84d77b980 100644 --- a/p2p/conn/secret_connection.go +++ b/p2p/conn/secret_connection.go @@ -133,6 +133,11 @@ func MakeSecretConnection(conn io.ReadWriteCloser, locPrivKey crypto.PrivKey) (* } remPubKey, remSignature := authSigMsg.Key, authSigMsg.Sig + + if remPubKey == nil { + return nil, errors.New("Peer sent a nil public key") + } + if !remPubKey.VerifyBytes(challenge[:], remSignature) { return nil, errors.New("Challenge verification failed") }