summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2004-06-18 22:23:22 +1000
committerDamien Miller <djm@mindrot.org>2004-06-18 22:23:22 +1000
commit3bbd878c2ec2b337b9e5b9455e0a2bd1902a0824 (patch)
treeb5d4eae0c95ab46b30b41f3f2f4611d8816adfda
parentb8ea24868f0347ea6d5116cbd93197c1ab0e942b (diff)
- djm@cvs.openbsd.org 2004/06/18 11:11:54
[channels.c clientloop.c] Don't explode in clientloop when we receive a bogus channel id, but also don't generate them to begin with; ok markus@
-rw-r--r--ChangeLog6
-rw-r--r--channels.c4
-rw-r--r--clientloop.c9
3 files changed, 12 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index adbb925ec..57dc1693a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,10 @@
32 [ssh.1 ssh.c] 32 [ssh.1 ssh.c]
33 trim synopsis for -S, allow -S and -oControlMaster, -MM means 'ask'; 33 trim synopsis for -S, allow -S and -oControlMaster, -MM means 'ask';
34 ok djm 34 ok djm
35 - djm@cvs.openbsd.org 2004/06/18 11:11:54
36 [channels.c clientloop.c]
37 Don't explode in clientloop when we receive a bogus channel id, but
38 also don't generate them to begin with; ok markus@
35 39
3620040617 4020040617
37 - (dtucker) [regress/scp.sh] diff -N is not portable (but needed for some 41 - (dtucker) [regress/scp.sh] diff -N is not portable (but needed for some
@@ -1305,4 +1309,4 @@
1305 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 1309 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
1306 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 1310 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
1307 1311
1308$Id: ChangeLog,v 1.3413 2004/06/18 12:21:55 djm Exp $ 1312$Id: ChangeLog,v 1.3414 2004/06/18 12:23:22 djm Exp $
diff --git a/channels.c b/channels.c
index 97c1fd31b..68d854388 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.205 2004/06/14 01:44:38 djm Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.206 2004/06/18 11:11:54 djm Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -487,7 +487,7 @@ channel_find_open(void)
487 487
488 for (i = 0; i < channels_alloc; i++) { 488 for (i = 0; i < channels_alloc; i++) {
489 c = channels[i]; 489 c = channels[i];
490 if (c == NULL) 490 if (c == NULL || c->remote_id < 0)
491 continue; 491 continue;
492 switch (c->type) { 492 switch (c->type) {
493 case SSH_CHANNEL_CLOSED: 493 case SSH_CHANNEL_CLOSED:
diff --git a/clientloop.c b/clientloop.c
index 8f2f270d7..79aabbe06 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -59,7 +59,7 @@
59 */ 59 */
60 60
61#include "includes.h" 61#include "includes.h"
62RCSID("$OpenBSD: clientloop.c,v 1.127 2004/06/17 15:10:13 djm Exp $"); 62RCSID("$OpenBSD: clientloop.c,v 1.128 2004/06/18 11:11:54 djm Exp $");
63 63
64#include "ssh.h" 64#include "ssh.h"
65#include "ssh1.h" 65#include "ssh1.h"
@@ -1626,8 +1626,9 @@ client_input_channel_req(int type, u_int32_t seq, void *ctxt)
1626 debug("client_input_channel_req: channel %d rtype %s reply %d", 1626 debug("client_input_channel_req: channel %d rtype %s reply %d",
1627 id, rtype, reply); 1627 id, rtype, reply);
1628 1628
1629 c = channel_lookup(id); 1629 if (id == -1) {
1630 if (c == NULL) { 1630 error("client_input_channel_req: request for channel -1");
1631 } else if ((c = channel_lookup(id)) == NULL) {
1631 error("client_input_channel_req: channel %d: unknown channel", id); 1632 error("client_input_channel_req: channel %d: unknown channel", id);
1632 } else if (strcmp(rtype, "exit-status") == 0) { 1633 } else if (strcmp(rtype, "exit-status") == 0) {
1633 exitval = packet_get_int(); 1634 exitval = packet_get_int();
@@ -1646,7 +1647,7 @@ client_input_channel_req(int type, u_int32_t seq, void *ctxt)
1646 if (reply) { 1647 if (reply) {
1647 packet_start(success ? 1648 packet_start(success ?
1648 SSH2_MSG_CHANNEL_SUCCESS : SSH2_MSG_CHANNEL_FAILURE); 1649 SSH2_MSG_CHANNEL_SUCCESS : SSH2_MSG_CHANNEL_FAILURE);
1649 packet_put_int(c->remote_id); 1650 packet_put_int(id);
1650 packet_send(); 1651 packet_send();
1651 } 1652 }
1652 xfree(rtype); 1653 xfree(rtype);