File openssh-7.2p2-kex_resource_depletion.patch of Package openssh.21987

# HG changeset patch
# Parent  60b2988645245873e56e7df004c9141bc0adcb1f
Prevent memory depletion during key exchange

CVE-2016-8858
bsc#1005480

upstream commit ec165c392ca54317dbe3064a8c200de6531e89ad

diff --git a/openssh-7.2p2/kex.c b/openssh-7.2p2/kex.c
--- a/openssh-7.2p2/kex.c
+++ b/openssh-7.2p2/kex.c
@@ -526,16 +526,17 @@ kex_input_kexinit(int type, u_int32_t se
 	u_int i;
 	size_t dlen;
 	int r;
 
 	debug("SSH2_MSG_KEXINIT received");
 	if (kex == NULL)
 		return SSH_ERR_INVALID_ARGUMENT;
 
+	ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, NULL);
 	ptr = sshpkt_ptr(ssh, &dlen);
 	if ((r = sshbuf_put(kex->peer, ptr, dlen)) != 0)
 		return r;
 
 	/* discard packet */
 	for (i = 0; i < KEX_COOKIE_LEN; i++)
 		if ((r = sshpkt_get_u8(ssh, NULL)) != 0)
 			return r;
openSUSE Build Service is sponsored by