Fix a segfault in ssh2_throttle_all_channels.

ssh2_channel_check_throttle should only be called on channels for
which c->chan != NULL - that is, only for channels that are not
delegated to a sharing downstream. But throttle_all_channels was
calling it for _all_ channels, so if it had the bad luck to be called
while a sharing downstream was active, ssh2_channel_check_throttle
would dereference the null c->chan for the first downstream channel it
found.
This commit is contained in:
Simon Tatham 2018-11-06 18:31:35 +00:00
Родитель a4b5f66d93
Коммит d222ed4251
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -1611,7 +1611,8 @@ static void ssh2_throttle_all_channels(ConnectionLayer *cl, bool throttled)
s->all_channels_throttled = throttled;
for (i = 0; NULL != (c = index234(s->channels, i)); i++)
ssh2_channel_check_throttle(c);
if (!c->sharectx)
ssh2_channel_check_throttle(c);
}
static bool ssh2_ldisc_option(ConnectionLayer *cl, int option)