mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 22:58:25 +00:00
Do not crash on TLS connection without certificate
This commit is contained in:
parent
cbae64fc06
commit
0b654581b6
@ -412,7 +412,13 @@ func listenConnect(myID string, disc *discover.Discoverer, m *Model, tlsCfg *tls
|
|||||||
|
|
||||||
next:
|
next:
|
||||||
for conn := range conns {
|
for conn := range conns {
|
||||||
remoteID := certID(conn.ConnectionState().PeerCertificates[0].Raw)
|
certs := conn.ConnectionState().PeerCertificates
|
||||||
|
if l := len(certs); l != 1 {
|
||||||
|
warnf("Got peer certificate list of length %d != 1; protocol error", l)
|
||||||
|
conn.Close()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
remoteID := certID(certs[0].Raw)
|
||||||
|
|
||||||
if remoteID == myID {
|
if remoteID == myID {
|
||||||
warnf("Connected to myself (%s) - should not happen", remoteID)
|
warnf("Connected to myself (%s) - should not happen", remoteID)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user