aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-13 17:41:50 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-13 17:41:50 +0100
commit2e14aa473ea20b485ed18f71c6ede2099c7b23cb (patch)
treea409f28a03b9d4011bacfc722a59c1926ac9f490 /src
parent6d40820bdeef5882dc91f7c7979f01a4cc94b824 (diff)
downloadrspamd-2e14aa473ea20b485ed18f71c6ede2099c7b23cb.tar.gz
rspamd-2e14aa473ea20b485ed18f71c6ede2099c7b23cb.zip
Fix regexp splitting in lua.
Diffstat (limited to 'src')
-rw-r--r--src/lua/lua_regexp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lua/lua_regexp.c b/src/lua/lua_regexp.c
index 48af6f7ab..18ceeb28a 100644
--- a/src/lua/lua_regexp.c
+++ b/src/lua/lua_regexp.c
@@ -491,6 +491,17 @@ lua_regexp_split (lua_State *L)
}
old_start = end;
}
+
+ if (len > 0 && (end == NULL || end < data + len)) {
+ if (end == NULL) {
+ end = data;
+ }
+
+ lua_pushlstring (L, end, (data + len) - end);
+ lua_rawseti (L, -2, ++i);
+ matched = TRUE;
+ }
+
if (!matched) {
lua_pop (L, 1);
lua_pushnil (L);