vishalmishra434 / rpms / openssh

Forked from rpms/openssh 3 months ago
Clone
Jakub Jelen ae831a
From 28652bca29046f62c7045e933e6b931de1d16737 Mon Sep 17 00:00:00 2001
Jakub Jelen ae831a
From: "markus@openbsd.org" <markus@openbsd.org>
Jakub Jelen ae831a
Date: Mon, 19 Sep 2016 19:02:19 +0000
Jakub Jelen ae831a
Subject: upstream commit
Jakub Jelen ae831a
Jakub Jelen ae831a
move inbound NEWKEYS handling to kex layer; otherwise
Jakub Jelen ae831a
early NEWKEYS causes NULL deref; found by Robert Swiecki/honggfuzz; fixed
Jakub Jelen ae831a
with & ok djm@
Jakub Jelen ae831a
Jakub Jelen ae831a
Upstream-ID: 9a68b882892e9f51dc7bfa9f5a423858af358b2f
Jakub Jelen ae831a
---
Jakub Jelen ae831a
 kex.c    | 4 +++-
Jakub Jelen ae831a
 packet.c | 6 ++----
Jakub Jelen ae831a
 2 files changed, 5 insertions(+), 5 deletions(-)
Jakub Jelen ae831a
Jakub Jelen ae831a
diff --git a/kex.c b/kex.c
Jakub Jelen ae831a
index f4c130f..8800d40 100644
Jakub Jelen ae831a
--- a/kex.c
Jakub Jelen ae831a
+++ b/kex.c
Jakub Jelen ae831a
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
Jakub Jelen ae831a
 	ssh_dispatch_set(ssh, SSH2_MSG_NEWKEYS, &kex_protocol_error);
Jakub Jelen ae831a
 	if ((r = sshpkt_get_end(ssh)) != 0)
Jakub Jelen ae831a
 		return r;
Jakub Jelen ae831a
+	if ((r = ssh_set_newkeys(ssh, MODE_IN)) != 0)
Jakub Jelen ae831a
+		return r;
Jakub Jelen ae831a
 	kex->done = 1;
Jakub Jelen ae831a
 	sshbuf_reset(kex->peer);
Jakub Jelen ae831a
 	/* sshbuf_reset(kex->my); */
Jakub Jelen ae831a
diff --git a/packet.c b/packet.c
Jakub Jelen ae831a
index 711091d..fb316ac 100644
Jakub Jelen ae831a
--- a/packet.c
Jakub Jelen ae831a
+++ b/packet.c
Jakub Jelen ae831a
@@ -1907,9 +1907,7 @@ ssh_packet_read_poll2(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
Jakub Jelen ae831a
 			return r;
Jakub Jelen ae831a
 		return SSH_ERR_PROTOCOL_ERROR;
Jakub Jelen ae831a
 	}
Jakub Jelen ae831a
-	if (*typep == SSH2_MSG_NEWKEYS)
Jakub Jelen ae831a
-		r = ssh_set_newkeys(ssh, MODE_IN);
Jakub Jelen ae831a
-	else if (*typep == SSH2_MSG_USERAUTH_SUCCESS && !state->server_side)
Jakub Jelen ae831a
+	if (*typep == SSH2_MSG_USERAUTH_SUCCESS && !state->server_side)
Jakub Jelen ae831a
 		r = ssh_packet_enable_delayed_compress(ssh);
Jakub Jelen ae831a
 	else
Jakub Jelen ae831a
 		r = 0;
Jakub Jelen ae831a
-- 
Jakub Jelen ae831a
cgit v0.12
Jakub Jelen ae831a
Jakub Jelen ae831a
0
Jakub Jelen ae831a