relay: add a missing buffer availability check
[project/uhttpd.git] / 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;