aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-10 14:16:38 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-10 14:16:38 +0100
commit704571a373230813fe1a619a8b4be75927b59b70 (patch)
tree1fcbdbf750e6e3700c8c12dc98e64b6e9bbff839
parent0619debb463445f442a5f9a6f7955ffbe006079b (diff)
downloadrspamd-704571a373230813fe1a619a8b4be75927b59b70.tar.gz
rspamd-704571a373230813fe1a619a8b4be75927b59b70.zip
[Minor] Fix fromtable method
-rw-r--r--src/lua/lua_text.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lua/lua_text.c b/src/lua/lua_text.c
index d02e1f5aa..328d6e8d5 100644
--- a/src/lua/lua_text.c
+++ b/src/lua/lua_text.c
@@ -190,7 +190,7 @@ lua_text_fromtable (lua_State *L)
delim = lua_tolstring (L, 2, &dlen);
}
else {
- dlen = strlen (delim);
+ dlen = 0;
}
/* Calculate length needed */
@@ -243,11 +243,13 @@ lua_text_fromtable (lua_State *L)
if (elt) {
memcpy (dest, elt->start, elt->len);
+ dest += elt->len;
}
}
- if (i != tblen - 1) {
+ if (dlen && i != tblen - 1) {
memcpy (dest, delim, dlen);
+ dest += dlen;
}
lua_pop (L, 1);