From 9d2d6c1e3693239d2283279f74ed70818a325931 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 31 Jan 2017 11:14:16 +0100 Subject: [PATCH] ssh: handle error from prepareKeyChange. Fixes #18850. Change-Id: Id3ae89233f9e95ec3238462bf2ecda3e0c515f88 Reviewed-on: https://go-review.googlesource.com/36051 Run-TryBot: Han-Wen Nienhuys TryBot-Result: Gobot Gobot Reviewed-by: Adam Langley --- ssh/handshake.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ssh/handshake.go b/ssh/handshake.go index 1b63ba8a6d..b9a207127d 100644 --- a/ssh/handshake.go +++ b/ssh/handshake.go @@ -574,7 +574,9 @@ func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error { } result.SessionID = t.sessionID - t.conn.prepareKeyChange(t.algorithms, result) + if err := t.conn.prepareKeyChange(t.algorithms, result); err != nil { + return err + } if err = t.conn.writePacket([]byte{msgNewKeys}); err != nil { return err }