projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix proxy reply parsing broken by the previous commit.
[tinc]
/
src
/
proxy.c
diff --git
a/src/proxy.c
b/src/proxy.c
index
165d3f3
..
22d4947
100644
(file)
--- a/
src/proxy.c
+++ b/
src/proxy.c
@@
-203,7
+203,7
@@
int receive_proxy_meta(connection_t *c, int start, int lenin) {
case PROXY_SOCKS5:
if(c->buflen < 2)
return 0;
case PROXY_SOCKS5:
if(c->buflen < 2)
return 0;
- if(c->buffer[0] != 0x05 || c->buffer[1] == 0xff) {
+ if(c->buffer[0] != 0x05 || c->buffer[1] ==
(char)
0xff) {
logger(LOG_ERR, "Proxy authentication method rejected");
return -1;
}
logger(LOG_ERR, "Proxy authentication method rejected");
return -1;
}
@@
-256,7
+256,12
@@
int receive_proxy_meta(connection_t *c, int start, int lenin) {
char *p = memchr(c->buffer, '\n', c->buflen);
if(!p || p - c->buffer >= c->buflen)
return 0;
char *p = memchr(c->buffer, '\n', c->buflen);
if(!p || p - c->buffer >= c->buflen)
return 0;
- p = memchr(p + 1, '\n', c->buflen - (p + 1 - c->buffer));
+
+ while((p = memchr(p + 1, '\n', c->buflen - (p + 1 - c->buffer)))) {
+ if(p > c->buffer + 3 && !memcmp(p - 3, "\r\n\r\n", 4))
+ break;
+ }
+
if(!p)
return 0;
if(!p)
return 0;