From 01020b60f6f01de68ae24af41117fff9b92e2a45 Mon Sep 17 00:00:00 2001
From: Andy Green <andy@warmcat.com>
Date: Sun, 28 Aug 2016 09:28:55 +0800
Subject: [PATCH] coverity 169273 - off-by-one on cgi chunking swallow limit

---
 lib/server.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/server.c b/lib/server.c
index a821371c..ab8b0a4d 100644
--- a/lib/server.c
+++ b/lib/server.c
@@ -2659,7 +2659,7 @@ lws_chunked_html_process(struct lws_process_html_args *args,
 			if (!s->pos)
 				s->start = sp;
 			s->swallow[s->pos++] = *sp;
-			if (s->pos == sizeof(s->swallow))
+			if (s->pos == sizeof(s->swallow) - 1)
 				goto skip;
 			for (n = 0; n < s->count_vars; n++)
 				if (!strncmp(s->swallow, s->vars[n], s->pos)) {
-- 
GitLab