1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-14 02:53:51 -05:00
Simon Tatham 12aa06ccc9 Fix double-free in remote->local forwardings.
This bug applies to both the new stream-based agent forwarding, and
ordinary remote->local TCP port forwardings, because it was introduced
by the preliminary infrastructure in commit 09954a87c.

new_connection() and sk_new() accept a SockAddr *, and take ownership
of it. So it's a mistake to make an address, connect to it, and then
sk_addr_free() it: the free will decrement its reference count to
zero, and then the Socket made by the connection will be holding a
stale pointer. But that's exactly what I was doing in the version of
portfwdmgr_connect() that I rewrote in that refactoring. And then I
made the same error again in commit ae1148267 in the Unix stream-based
agent forwarding.

Now both fixed. Rather than remove the sk_addr_free() to make the code
look more like it used to, I've instead solved the problem by adding
an sk_addr_dup() at the point of making the connection. The idea is
that that should be more robust, in that it will still do the right
thing if portfwdmgr_connect_socket should later change so as not to
call its connect helper function at all.

The new Windows stream-based agent forwarding is unaffected by this
bug, because it calls new_named_pipe_client() with a pathname in
string format, without first wrapping it into a SockAddr.
2020-01-14 19:52:54 +00:00
..
2019-11-02 08:37:30 +00:00
2019-10-14 19:42:37 +01:00
2019-03-31 10:35:10 +01:00
2019-10-14 19:42:37 +01:00
2019-10-14 19:42:37 +01:00
2019-10-14 19:42:37 +01:00
2019-10-14 19:42:37 +01:00
2019-10-14 19:42:37 +01:00