Fix proxy reply parsing broken by the previous commit.
authorGuus Sliepen <guus@tinc-vpn.org>
Fri, 14 Oct 2016 12:27:19 +0000 (14:27 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Fri, 14 Oct 2016 12:27:19 +0000 (14:27 +0200)
src/proxy.c

index 2b8f87c13e36dcc5d32e47968ae8f33b2c14ae3c..22d494718d959971e153f805b119e86ae1a71e6a 100644 (file)
@@ -257,8 +257,8 @@ int receive_proxy_meta(connection_t *c, int start, int lenin) {
                if(!p || p - c->buffer >= c->buflen)
                        return 0;
 
-               while(p = memchr(p + 1, '\n', c->buflen - (p + 1 - c->buffer))) {
-                       if(p[-1] == '\n')
+               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;
                }