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 ba6b95a496ea4e2cfa6f066a1d5a78bad8555c0a..83664e60eb70605541ece0e0bc14e62a1e777025 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);
+               if (!buf || !len)
+                       break;
+
                newline = strchr(buf, '\n');
                if (!newline)
                        break;