1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Chas Honton's patch to dynamic port forwarding: should allow longer

host names in SOCKS 4A, up to 255 characters (which is apparently
the DNS limit anyway).

[originally from svn r3080]
This commit is contained in:
Simon Tatham 2003-04-09 09:09:57 +00:00
parent 98a608c2e4
commit ab7e6fa1cd

View File

@ -74,7 +74,7 @@ struct PFwdPrivate {
* we can also use them as a buffer and pointer for reading
* data from the SOCKS client.
*/
char hostname[256];
char hostname[256+8];
int port;
/*
* When doing dynamic port forwarding, we can receive
@ -159,15 +159,15 @@ static int pfd_receive(Plug plug, int urgent, char *data, int len)
int len;
if (pr->dynamic == 0x4000) {
pr->dynamic = 0x4001;
pr->port = 8; /* reset buffer to overwrite name */
continue;
}
pr->hostname[0] = 0; /* reply version code */
pr->hostname[1] = 90; /* request granted */
sk_write(pr->s, pr->hostname, 8);
len= pr->port;
pr->port = GET_16BIT_MSB_FIRST(pr->hostname+2);
len = strlen(pr->hostname+8);
memmove(pr->hostname, pr->hostname + 8 + len + 1,
lenof(pr->hostname) - (8 + len + 1));
memmove(pr->hostname, pr->hostname + 8, len);
goto connect;
} else {
/*