89c94b
diff --git a/modules/lua/lua_request.c b/modules/lua/lua_request.c
89c94b
index 77a88b4..1d8be2e 100644
89c94b
--- a/modules/lua/lua_request.c
89c94b
+++ b/modules/lua/lua_request.c
89c94b
@@ -376,6 +376,7 @@ static int req_parsebody(lua_State *L)
89c94b
             if (end == NULL) break;
89c94b
             key = (char *) apr_pcalloc(r->pool, 256);
89c94b
             filename = (char *) apr_pcalloc(r->pool, 256);
89c94b
+            if (end - crlf <= 8) break;
89c94b
             vlen = end - crlf - 8;
89c94b
             buffer = (char *) apr_pcalloc(r->pool, vlen+1);
89c94b
             memcpy(buffer, crlf + 4, vlen);