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 2b8f87c..22d4947 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;
                }