summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2017-09-12 06:35:31 +0000
committerDamien Miller <djm@mindrot.org>2017-09-12 17:37:03 +1000
commit9f53229c2ac97dbc6f5a03657de08a1150a9ac7e (patch)
tree4f74dc06676dc6dce2b2bc3aa6beb248a1d8def6 /clientloop.c
parentdbee4119b502e3f8b6cd3282c69c537fd01d8e16 (diff)
upstream commit
Make remote channel ID a u_int Previously we tracked the remote channel IDs in an int, but this is strictly incorrect: the wire protocol uses uint32 and there is nothing in-principle stopping a SSH implementation from sending, say, 0xffff0000. In practice everyone numbers their channels sequentially, so this has never been a problem. ok markus@ Upstream-ID: b9f4cd3dc53155b4a5c995c0adba7da760d03e73
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/clientloop.c b/clientloop.c
index 1218b3b71..829eae024 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.303 2017/09/12 06:32:07 djm Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.304 2017/09/12 06:35:32 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1682,6 +1682,7 @@ client_input_channel_open(int type, u_int32_t seq, struct ssh *ssh)
1682 } else if (c != NULL) { 1682 } else if (c != NULL) {
1683 debug("confirm %s", ctype); 1683 debug("confirm %s", ctype);
1684 c->remote_id = rchan; 1684 c->remote_id = rchan;
1685 c->have_remote_id = 1;
1685 c->remote_window = rwindow; 1686 c->remote_window = rwindow;
1686 c->remote_maxpacket = rmaxpack; 1687 c->remote_maxpacket = rmaxpack;
1687 if (c->type != SSH_CHANNEL_CONNECTING) { 1688 if (c->type != SSH_CHANNEL_CONNECTING) {
@@ -1749,6 +1750,9 @@ client_input_channel_req(int type, u_int32_t seq, struct ssh *ssh)
1749 packet_check_eom(); 1750 packet_check_eom();
1750 } 1751 }
1751 if (reply && c != NULL && !(c->flags & CHAN_CLOSE_SENT)) { 1752 if (reply && c != NULL && !(c->flags & CHAN_CLOSE_SENT)) {
1753 if (!c->have_remote_id)
1754 fatal("%s: channel %d: no remote_id",
1755 __func__, c->self);
1752 packet_start(success ? 1756 packet_start(success ?
1753 SSH2_MSG_CHANNEL_SUCCESS : SSH2_MSG_CHANNEL_FAILURE); 1757 SSH2_MSG_CHANNEL_SUCCESS : SSH2_MSG_CHANNEL_FAILURE);
1754 packet_put_int(c->remote_id); 1758 packet_put_int(c->remote_id);