summaryrefslogtreecommitdiff
path: root/serverloop.c
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2019-11-27 05:38:43 +0000
committerDamien Miller <djm@mindrot.org>2019-11-28 09:38:11 +1100
commit6e1d1bbf5a3eca875005e0c87f341a0a03799809 (patch)
tree4ba782eeb17fa5a5fe94a0bacaacff31e360e867 /serverloop.c
parent48989244658b9748b6801034ff4ffbdfc6b1520f (diff)
upstream: Revert previous commit. The channels code still uses int
in many places for channel ids so the INT_MAX check still makes sense. OpenBSD-Commit-ID: 532e4b644791b826956c3c61d6ac6da39bac84bf
Diffstat (limited to 'serverloop.c')
-rw-r--r--serverloop.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/serverloop.c b/serverloop.c
index 16a4fd3e5..99d259201 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: serverloop.c,v 1.217 2019/11/27 03:34:04 dtucker Exp $ */ 1/* $OpenBSD: serverloop.c,v 1.218 2019/11/27 05:38:43 dtucker 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
@@ -675,7 +675,7 @@ server_input_channel_open(int type, u_int32_t seq, struct ssh *ssh)
675 char *ctype = NULL; 675 char *ctype = NULL;
676 const char *errmsg = NULL; 676 const char *errmsg = NULL;
677 int r, reason = SSH2_OPEN_CONNECT_FAILED; 677 int r, reason = SSH2_OPEN_CONNECT_FAILED;
678 u_int32_t rchan = 0, rmaxpack = 0, rwindow = 0; 678 u_int rchan = 0, rmaxpack = 0, rwindow = 0;
679 679
680 if ((r = sshpkt_get_cstring(ssh, &ctype, NULL)) != 0 || 680 if ((r = sshpkt_get_cstring(ssh, &ctype, NULL)) != 0 ||
681 (r = sshpkt_get_u32(ssh, &rchan)) != 0 || 681 (r = sshpkt_get_u32(ssh, &rchan)) != 0 ||
@@ -683,9 +683,11 @@ server_input_channel_open(int type, u_int32_t seq, struct ssh *ssh)
683 (r = sshpkt_get_u32(ssh, &rmaxpack)) != 0) 683 (r = sshpkt_get_u32(ssh, &rmaxpack)) != 0)
684 sshpkt_fatal(ssh, r, "%s: parse packet", __func__); 684 sshpkt_fatal(ssh, r, "%s: parse packet", __func__);
685 debug("%s: ctype %s rchan %u win %u max %u", __func__, 685 debug("%s: ctype %s rchan %u win %u max %u", __func__,
686 ctype, (u_int)rchan, (u_int)rwindow, (u_int)rmaxpack); 686 ctype, rchan, rwindow, rmaxpack);
687 687
688 if (strcmp(ctype, "session") == 0) { 688 if (rchan > INT_MAX) {
689 error("%s: invalid remote channel ID", __func__);
690 } else if (strcmp(ctype, "session") == 0) {
689 c = server_request_session(ssh); 691 c = server_request_session(ssh);
690 } else if (strcmp(ctype, "direct-tcpip") == 0) { 692 } else if (strcmp(ctype, "direct-tcpip") == 0) {
691 c = server_request_direct_tcpip(ssh, &reason, &errmsg); 693 c = server_request_direct_tcpip(ssh, &reason, &errmsg);
@@ -696,7 +698,7 @@ server_input_channel_open(int type, u_int32_t seq, struct ssh *ssh)
696 } 698 }
697 if (c != NULL) { 699 if (c != NULL) {
698 debug("%s: confirm %s", __func__, ctype); 700 debug("%s: confirm %s", __func__, ctype);
699 c->remote_id = rchan; 701 c->remote_id = (int)rchan;
700 c->have_remote_id = 1; 702 c->have_remote_id = 1;
701 c->remote_window = rwindow; 703 c->remote_window = rwindow;
702 c->remote_maxpacket = rmaxpack; 704 c->remote_maxpacket = rmaxpack;