projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
BUG_SSH2_DERIVEKEY is apparently only present in SSH 2.0.11 and
[u/mdw/putty]
/
proxy.c
diff --git
a/proxy.c
b/proxy.c
index
0760e7e
..
475dc4a
100644
(file)
--- a/
proxy.c
+++ b/
proxy.c
@@
-459,13
+459,14
@@
int proxy_http_negotiate (Proxy_Socket p, int change)
* for this proxy method, it's just a simple HTTP
* request
*/
* for this proxy method, it's just a simple HTTP
* request
*/
- char
buf[256]
, dest[64];
+ char
*buf
, dest[64];
sk_getaddr(p->remote_addr, dest, 64);
sk_getaddr(p->remote_addr, dest, 64);
-
sprintf(buf,
"CONNECT %s:%i HTTP/1.1\r\nHost: %s:%i\r\n",
- dest, p->remote_port, dest, p->remote_port);
+
buf = dupprintf(
"CONNECT %s:%i HTTP/1.1\r\nHost: %s:%i\r\n",
+
dest, p->remote_port, dest, p->remote_port);
sk_write(p->sub_socket, buf, strlen(buf));
sk_write(p->sub_socket, buf, strlen(buf));
+ sfree(buf);
if (cfg.proxy_username[0] || cfg.proxy_password[0]) {
char buf[sizeof(cfg.proxy_username)+sizeof(cfg.proxy_password)];
if (cfg.proxy_username[0] || cfg.proxy_password[0]) {
char buf[sizeof(cfg.proxy_username)+sizeof(cfg.proxy_password)];
@@
-480,8
+481,7
@@
int proxy_http_negotiate (Proxy_Socket p, int change)
sk_write(p->sub_socket, buf2, strlen(buf2));
}
sk_write(p->sub_socket, buf2, strlen(buf2));
}
- sprintf(buf, "\r\n");
- sk_write(p->sub_socket, buf, strlen(buf));
+ sk_write(p->sub_socket, "\r\n", 2);
p->state = 1;
return 0;
p->state = 1;
return 0;
@@
-556,14
+556,14
@@
int proxy_http_negotiate (Proxy_Socket p, int change)
bufchain_consume(&p->pending_input_data, eol);
if (data[status] != '2') {
/* error */
bufchain_consume(&p->pending_input_data, eol);
if (data[status] != '2') {
/* error */
- char
buf[1024]
;
+ char
*buf
;
data[eol] = '\0';
while (eol > status &&
(data[eol-1] == '\r' || data[eol-1] == '\n'))
data[--eol] = '\0';
data[eol] = '\0';
while (eol > status &&
(data[eol-1] == '\r' || data[eol-1] == '\n'))
data[--eol] = '\0';
- sprintf(buf, "Proxy error: %.900s",
- data+status);
+ buf = dupprintf("Proxy error: %s", data+status);
plug_closing(p->plug, buf, PROXY_ERROR_GENERAL, 0);
plug_closing(p->plug, buf, PROXY_ERROR_GENERAL, 0);
+ sfree(buf);
sfree(data);
return 1;
}
sfree(data);
return 1;
}
@@
-594,6
+594,7
@@
int proxy_http_negotiate (Proxy_Socket p, int change)
{
bufchain_consume(&p->pending_input_data, eol);
datap += eol;
{
bufchain_consume(&p->pending_input_data, eol);
datap += eol;
+ len -= eol;
eol = get_line_end(datap, len);
}
eol = get_line_end(datap, len);
}
@@
-929,7
+930,7
@@
int proxy_socks5_negotiate (Proxy_Socket p, int change)
char command[22];
int len;
char command[22];
int len;
- if (sk_addrtype(p->remote_addr) == ADDRTYPE_IPV
6
) {
+ if (sk_addrtype(p->remote_addr) == ADDRTYPE_IPV
4
) {
len = 10;
command[3] = 1; /* IPv4 */
} else {
len = 10;
command[3] = 1; /* IPv4 */
} else {