Additional corrections to OpenSSH buffer handling.

Obtained from:  openssh.org
Originally committed to head by: nectar
This commit is contained in:
Josef Karthauser 2003-09-26 19:15:53 +00:00
parent c9f007b685
commit 3533e7e58a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=120489

View File

@ -229,12 +229,13 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
if (found == -1) {
/* There are no free slots. Take last+1 slot and expand the array. */
found = channels_alloc;
channels_alloc += 10;
if (channels_alloc > 10000)
fatal("channel_new: internal error: channels_alloc %d "
"too big.", channels_alloc);
channels = xrealloc(channels,
(channels_alloc + 10) * sizeof(Channel *));
channels_alloc += 10;
debug2("channel: expanding %d", channels_alloc);
channels = xrealloc(channels, channels_alloc * sizeof(Channel *));
for (i = found; i < channels_alloc; i++)
channels[i] = NULL;
}