summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-07-31 18:29:03 +0200
committerFelix Fietkau <nbd@openwrt.org>2013-07-31 18:29:03 +0200
commitfae8886f8aa5d996c8de607abea8b677216549b5 (patch)
treee615cb6bc97bc54c5b9c706937373697c347e6e3
parent7823ad9590d0ec54bca6f637e0d8b14794bb49c0 (diff)
client: prevent further read calls after a client has been freed
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r--client.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/client.c b/client.c
index 173285a..3185b8f 100644
--- a/client.c
+++ b/client.c
@@ -24,6 +24,7 @@
#include "tls.h"
static LIST_HEAD(clients);
+static bool client_done = false;
int n_clients = 0;
struct config conf = {};
@@ -442,6 +443,7 @@ void uh_client_read_cb(struct client *cl)
char *str;
int len;
+ client_done = false;
do {
str = ustream_get_read_buf(us, &len);
if (!str || !len)
@@ -456,11 +458,12 @@ void uh_client_read_cb(struct client *cl)
uh_header_error(cl, 413, "Request Entity Too Large");
break;
}
- } while(1);
+ } while (!client_done);
}
static void client_close(struct client *cl)
{
+ client_done = true;
n_clients--;
uh_dispatch_done(cl);
uloop_timeout_cancel(&cl->timeout);