mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-31 10:34:32 -05:00
Fix stale-pointer bugs in connection-fatal network errors.
I think these began to appear as a consequencce of replacing fatalbox() calls with more sensible error reports: the more specific a direction I send a report in, the greater the annoying possibility of re-entrance when the resulting error handler starts closing stuff.
This commit is contained in:
2
ssh.c
2
ssh.c
@@ -7784,6 +7784,8 @@ static int ssh2_try_send(struct ssh_channel *c)
|
||||
ssh2_pkt_addstring_start(pktout);
|
||||
ssh2_pkt_addstring_data(pktout, data, len);
|
||||
ssh2_pkt_send(ssh, pktout);
|
||||
if (!ssh->s) /* a network error might have closed the socket */
|
||||
break;
|
||||
bufchain_consume(&c->v.v2.outbuffer, len);
|
||||
c->v.v2.remwindow -= len;
|
||||
}
|
||||
|
@@ -1431,8 +1431,10 @@ static void net_select_result(int fd, int event)
|
||||
while (err && s->addr && sk_nextaddr(s->addr, &s->step)) {
|
||||
err = try_connect(s);
|
||||
}
|
||||
if (err)
|
||||
if (err) {
|
||||
plug_closing(s->plug, strerror(err), err, 0);
|
||||
return; /* socket is now presumably defunct */
|
||||
}
|
||||
if (!s->connected)
|
||||
return; /* another async attempt in progress */
|
||||
}
|
||||
|
Reference in New Issue
Block a user