]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix fromtable method
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 10 Oct 2019 13:16:38 +0000 (14:16 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 10 Oct 2019 13:16:38 +0000 (14:16 +0100)
src/lua/lua_text.c

index d02e1f5aa2c058390d7535da6a5970cd8d5c362f..328d6e8d5f631c862abca5fd4efa744d42a4838d 100644 (file)
@@ -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);