aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_text.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-01-25 16:09:31 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-01-25 16:47:14 +0000
commit01dd389504620aaea909f2c8f2ec8e753e657bd8 (patch)
tree3891aee73777689a984c342c36658535eeb69e2f /src/lua/lua_text.c
parent9bad1e7d1c92bd1909d3d03b8878b9e54b2cd345 (diff)
downloadrspamd-01dd389504620aaea909f2c8f2ec8e753e657bd8.tar.gz
rspamd-01dd389504620aaea909f2c8f2ec8e753e657bd8.zip
[Minor] Lua_text: Sanitize span length
Diffstat (limited to 'src/lua/lua_text.c')
-rw-r--r--src/lua/lua_text.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lua/lua_text.c b/src/lua/lua_text.c
index de8fa9b93..307b2823f 100644
--- a/src/lua/lua_text.c
+++ b/src/lua/lua_text.c
@@ -460,7 +460,8 @@ lua_text_span (lua_State *L)
if (len == -1) {
len = t->len - (start - 1);
}
- else if (len > (t->len - (start - 1))) {
+
+ if (len < 0 || (len > (t->len - (start - 1)))) {
return luaL_error (L, "invalid length");
}