]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix creation of the text from table
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 10 Oct 2019 10:15:25 +0000 (11:15 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 10 Oct 2019 10:15:25 +0000 (11:15 +0100)
src/lua/lua_text.c

index 63b1b22a8dc3eaa2fd45e5642ed10919b0bf5d08..d02e1f5aa2c058390d7535da6a5970cd8d5c362f 100644 (file)
@@ -215,8 +215,11 @@ lua_text_fromtable (lua_State *L)
                        }
                }
 
+               if (i != tblen - 1) {
+                       textlen += dlen;
+               }
+
                lua_pop (L, 1);
-               textlen += dlen;
        }
 
        /* Allocate new text */
@@ -243,7 +246,10 @@ lua_text_fromtable (lua_State *L)
                        }
                }
 
-               memcpy (dest, delim, dlen);
+               if (i != tblen - 1) {
+                       memcpy (dest, delim, dlen);
+               }
+
                lua_pop (L, 1);
        }