commit 614b48d: [Minor] Fix creation of the text from table

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Oct 10 10:35:05 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-10-10 11:15:25 +0100
URL: https://github.com/rspamd/rspamd/commit/614b48d55f1a4084fd4ef9de95603ba4334e6837

[Minor] Fix creation of the text from table

---
 src/lua/lua_text.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/lua/lua_text.c b/src/lua/lua_text.c
index 63b1b22a8..d02e1f5aa 100644
--- a/src/lua/lua_text.c
+++ b/src/lua/lua_text.c
@@ -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);
 	}
 


More information about the Commits mailing list