commit 01dd389: [Minor] Lua_text: Sanitize span length

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Jan 25 16:49:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-01-25 16:09:31 +0000
URL: https://github.com/rspamd/rspamd/commit/01dd389504620aaea909f2c8f2ec8e753e657bd8

[Minor] Lua_text: Sanitize span length

---
 src/lua/lua_text.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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");
 		}
 


More information about the Commits mailing list