commit 704571a: [Minor] Fix fromtable method
Vsevolod Stakhov
vsevolod at highsecure.ru
Thu Oct 10 13:21:06 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-10-10 14:16:38 +0100
URL: https://github.com/rspamd/rspamd/commit/704571a373230813fe1a619a8b4be75927b59b70 (HEAD -> master)
[Minor] Fix fromtable method
---
src/lua/lua_text.c | 6 ++++--
1 file 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);
More information about the Commits
mailing list