relay: add a missing buffer availability check
authorFelix Fietkau <nbd@openwrt.org>
Fri, 15 Mar 2013 13:38:16 +0000 (14:38 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 15 Mar 2013 13:38:19 +0000 (14:38 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
relay.c

diff --git a/relay.c b/relay.c
index ba6b95a..83664e6 100644 (file)
--- a/relay.c
+++ b/relay.c
@@ -76,6 +76,9 @@ static void relay_process_headers(struct relay *r)
                char *val;
 
                buf = ustream_get_read_buf(s, &len);
                char *val;
 
                buf = ustream_get_read_buf(s, &len);
+               if (!buf || !len)
+                       break;
+
                newline = strchr(buf, '\n');
                if (!newline)
                        break;
                newline = strchr(buf, '\n');
                if (!newline)
                        break;