]> source.dussan.org Git - rspamd.git/commitdiff
Some fixes to pushing captures to lua.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 30 Jun 2015 12:42:50 +0000 (13:42 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 30 Jun 2015 12:49:25 +0000 (13:49 +0100)
src/lua/lua_regexp.c

index 2103d1d9c8a1973e21d686e0b5686029572ce7b3..c405e33d85f3428fa207dafbf654d39533debb2b 100644 (file)
@@ -343,12 +343,13 @@ lua_regexp_search (lua_State *L)
                                                cap = &g_array_index (captures, struct rspamd_re_capture,
                                                                capn);
                                                lua_pushlstring (L, cap->p, cap->len);
-                                               lua_rawseti (L, -2, capn + 1);
+                                               lua_rawseti (L, -2, capn + 2);
                                        }
 
-                                       lua_rawseti (L, -3, ++i);
+                                       lua_rawseti (L, -2, ++i);
                                }
                                else {
+                                       lua_pushlstring (L, start, end - start);
                                        lua_rawseti (L, -2, ++i);
                                }