mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-10 07:38:06 -05:00
Avoid passing -1 as an fd to uxsel_set().
I'd missed out an if statement in the Unix proxy stderr code introduced by commit 297efff30, causing ret->cmd_err to be passed to uxsel_set even when it was -1 (which happened in the non-GUI tools). Unfortunately, putting a negative fd into the uxsel tree has really bad effects, because the first_fd / next_fd interface returns a negative number to signal end-of-list - and since the uxsel tree is sorted by fd, that happens _immediately_. Added the missing if statement, and also an assertion to make sure we never pass -1 to uxsel_set by mistake again!
This commit is contained in:
parent
50d73d95da
commit
6c9aa9be32
@ -405,7 +405,8 @@ Socket platform_new_connection(SockAddr addr, const char *hostname,
|
||||
add234(localproxy_by_errfd, ret);
|
||||
|
||||
uxsel_set(ret->from_cmd, 1, localproxy_select_result);
|
||||
uxsel_set(ret->cmd_err, 1, localproxy_select_result);
|
||||
if (ret->cmd_err >= 0)
|
||||
uxsel_set(ret->cmd_err, 1, localproxy_select_result);
|
||||
|
||||
/* We are responsible for this and don't need it any more */
|
||||
sk_addr_free(addr);
|
||||
|
@ -64,6 +64,8 @@ void uxsel_set(int fd, int rwx, uxsel_callback_fn callback)
|
||||
{
|
||||
struct fd *newfd;
|
||||
|
||||
assert(fd >= 0);
|
||||
|
||||
uxsel_del(fd);
|
||||
|
||||
if (rwx) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user