summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/channels.c b/channels.c
index 95a51e21b..e4917f3c9 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.398 2020/04/25 06:59:36 dtucker Exp $ */ 1/* $OpenBSD: channels.c,v 1.402 2020/09/20 05:47:25 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
@@ -354,6 +354,7 @@ channel_new(struct ssh *ssh, char *ctype, int type, int rfd, int wfd, int efd,
354 struct ssh_channels *sc = ssh->chanctxt; 354 struct ssh_channels *sc = ssh->chanctxt;
355 u_int i, found; 355 u_int i, found;
356 Channel *c; 356 Channel *c;
357 int r;
357 358
358 /* Try to find a free slot where to put the new channel. */ 359 /* Try to find a free slot where to put the new channel. */
359 for (i = 0; i < sc->channels_alloc; i++) { 360 for (i = 0; i < sc->channels_alloc; i++) {
@@ -383,6 +384,8 @@ channel_new(struct ssh *ssh, char *ctype, int type, int rfd, int wfd, int efd,
383 (c->output = sshbuf_new()) == NULL || 384 (c->output = sshbuf_new()) == NULL ||
384 (c->extended = sshbuf_new()) == NULL) 385 (c->extended = sshbuf_new()) == NULL)
385 fatal("%s: sshbuf_new failed", __func__); 386 fatal("%s: sshbuf_new failed", __func__);
387 if ((r = sshbuf_set_max_size(c->input, CHAN_INPUT_MAX)) != 0)
388 fatal("%s: sshbuf_set_max_size: %s", __func__, ssh_err(r));
386 c->ostate = CHAN_OUTPUT_OPEN; 389 c->ostate = CHAN_OUTPUT_OPEN;
387 c->istate = CHAN_INPUT_OPEN; 390 c->istate = CHAN_INPUT_OPEN;
388 channel_register_fds(ssh, c, rfd, wfd, efd, extusage, nonblock, 0); 391 channel_register_fds(ssh, c, rfd, wfd, efd, extusage, nonblock, 0);
@@ -603,6 +606,10 @@ channel_free(struct ssh *ssh, Channel *c)
603 606
604 if (c->type == SSH_CHANNEL_MUX_CLIENT) 607 if (c->type == SSH_CHANNEL_MUX_CLIENT)
605 mux_remove_remote_forwardings(ssh, c); 608 mux_remove_remote_forwardings(ssh, c);
609 else if (c->type == SSH_CHANNEL_MUX_LISTENER) {
610 free(c->mux_ctx);
611 c->mux_ctx = NULL;
612 }
606 613
607 if (log_level_get() >= SYSLOG_LEVEL_DEBUG3) { 614 if (log_level_get() >= SYSLOG_LEVEL_DEBUG3) {
608 s = channel_open_message(ssh); 615 s = channel_open_message(ssh);