Blame SOURCES/openssh-8.0p1-channel-limits.patch

7afad6
diff -up openssh-8.0p1/channels.c.channel-limits openssh-8.0p1/channels.c
7afad6
--- openssh-8.0p1/channels.c.channel-limits	2021-03-16 12:17:58.905576511 +0100
7afad6
+++ openssh-8.0p1/channels.c	2021-03-16 12:17:58.925576667 +0100
7afad6
@@ -354,6 +354,7 @@ channel_new(struct ssh *ssh, char *ctype
7afad6
 	struct ssh_channels *sc = ssh->chanctxt;
7afad6
 	u_int i, found;
7afad6
 	Channel *c;
7afad6
+	int r;
7afad6
 
7afad6
 	/* Try to find a free slot where to put the new channel. */
7afad6
 	for (i = 0; i < sc->channels_alloc; i++) {
7afad6
@@ -383,6 +384,8 @@ channel_new(struct ssh *ssh, char *ctype
7afad6
 	    (c->output = sshbuf_new()) == NULL ||
7afad6
 	    (c->extended = sshbuf_new()) == NULL)
7afad6
 		fatal("%s: sshbuf_new failed", __func__);
7afad6
+	if ((r = sshbuf_set_max_size(c->input, CHAN_INPUT_MAX)) != 0)
7afad6
+		fatal("%s: sshbuf_set_max_size: %s", __func__, ssh_err(r));
7afad6
 	c->ostate = CHAN_OUTPUT_OPEN;
7afad6
 	c->istate = CHAN_INPUT_OPEN;
7afad6
 	channel_register_fds(ssh, c, rfd, wfd, efd, extusage, nonblock, 0);
7afad6
diff -up openssh-8.0p1/channels.h.channel-limits openssh-8.0p1/channels.h
7afad6
--- openssh-8.0p1/channels.h.channel-limits	2021-03-16 12:17:58.868576223 +0100
7afad6
+++ openssh-8.0p1/channels.h	2021-03-16 12:17:58.907576527 +0100
7afad6
@@ -215,6 +215,9 @@ struct Channel {
7afad6
 /* Read buffer size */
7afad6
 #define CHAN_RBUF	(16*1024)
7afad6
 
7afad6
+/* Maximum channel input buffer size */
7afad6
+#define CHAN_INPUT_MAX	(16*1024*1024)
7afad6
+
7afad6
 /* Hard limit on number of channels */
7afad6
 #define CHANNELS_MAX_CHANNELS	(16*1024)
7afad6