ubus: duplicate request buffer to avoid memory corruption with multiple requests
[project/uhttpd.git] / client.c
index 3163afc..a971b3b 100644 (file)
--- a/client.c
+++ b/client.c
@@ -194,8 +194,10 @@ static bool client_init_cb(struct client *cl, char *buf, int len)
        if (!newline)
                return false;
 
-       if (newline == buf)
+       if (newline == buf) {
+               ustream_consume(cl->us, 2);
                return true;
+       }
 
        *newline = 0;
        blob_buf_init(&cl->hdr, 0);
@@ -567,6 +569,7 @@ bool uh_accept_client(int fd, bool tls)
        next_client = NULL;
        n_clients++;
        cl->id = client_id++;
+       cl->tls = tls;
 
        return true;
 }