From 9939562bbe0bde2167812b19b243418d719e26f6 Mon Sep 17 00:00:00 2001 From: Zaki Manian Date: Fri, 20 Sep 2019 09:37:49 -0700 Subject: [PATCH] Fix for panic in signature verification if a peer sends a nil public key. --- p2p/conn/secret_connection.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/p2p/conn/secret_connection.go b/p2p/conn/secret_connection.go index 7f76ac800..0e10ba241 100644 --- a/p2p/conn/secret_connection.go +++ b/p2p/conn/secret_connection.go @@ -122,6 +122,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") }