]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream commit
authormarkus@openbsd.org <markus@openbsd.org>
Mon, 19 Sep 2016 19:02:19 +0000 (19:02 +0000)
committerDamien Miller <djm@mindrot.org>
Wed, 21 Sep 2016 01:03:55 +0000 (11:03 +1000)
move inbound NEWKEYS handling to kex layer; otherwise
early NEWKEYS causes NULL deref; found by Robert Swiecki/honggfuzz; fixed
with & ok djm@

Upstream-ID: 9a68b882892e9f51dc7bfa9f5a423858af358b2f

kex.c
packet.c

diff --git a/kex.c b/kex.c
index f4c130f147b1be363f2c8f7f590eac5dfb9617b3..8800d4001a82e456b561691b57e8cc262c6fb2b0 100644 (file)
--- a/kex.c
+++ b/kex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.121 2016/09/12 23:31:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.122 2016/09/19 19:02:19 markus Exp $ */
 /*
  * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
  *
@@ -425,6 +425,8 @@ kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
        ssh_dispatch_set(ssh, SSH2_MSG_NEWKEYS, &kex_protocol_error);
        if ((r = sshpkt_get_end(ssh)) != 0)
                return r;
+       if ((r = ssh_set_newkeys(ssh, MODE_IN)) != 0)
+               return r;
        kex->done = 1;
        sshbuf_reset(kex->peer);
        /* sshbuf_reset(kex->my); */
index 711091da7f38702b60ebf1bea1085d7e92a7bf16..fb316acbcc11588a15c0f1246f55f4f6b6cfecd4 100644 (file)
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.237 2016/09/12 01:22:38 deraadt Exp $ */
+/* $OpenBSD: packet.c,v 1.238 2016/09/19 19:02:19 markus Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1907,9 +1907,7 @@ ssh_packet_read_poll2(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
                        return r;
                return SSH_ERR_PROTOCOL_ERROR;
        }
-       if (*typep == SSH2_MSG_NEWKEYS)
-               r = ssh_set_newkeys(ssh, MODE_IN);
-       else if (*typep == SSH2_MSG_USERAUTH_SUCCESS && !state->server_side)
+       if (*typep == SSH2_MSG_USERAUTH_SUCCESS && !state->server_side)
                r = ssh_packet_enable_delayed_compress(ssh);
        else
                r = 0;