commit d48c89a: [Fix] Avoid buffer overflow when printing long lua strings

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Apr 26 15:49:11 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-04-26 16:16:54 +0100
URL: https://github.com/rspamd/rspamd/commit/d48c89a83f6104699e07bbda42c9850b8a090043

[Fix] Avoid buffer overflow when printing long lua strings

---
 src/lua/lua_logger.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lua/lua_logger.c b/src/lua/lua_logger.c
index 67b70eaad..9d25fce6a 100644
--- a/src/lua/lua_logger.c
+++ b/src/lua/lua_logger.c
@@ -413,11 +413,11 @@ lua_logger_out_userdata (lua_State *L, gint pos, gchar *outbuf, gsize len,
 	}
 
 	if (converted_to_str) {
-		r = rspamd_snprintf (outbuf, len + 1, "%s", str);
+		r = rspamd_snprintf (outbuf, len, "%s", str);
 	}
 	else {
 		/* Print raw pointer */
-		r = rspamd_snprintf (outbuf, len + 1, "%s(%p)", str, lua_touserdata (L, pos));
+		r = rspamd_snprintf (outbuf, len, "%s(%p)", str, lua_touserdata (L, pos));
 	}
 
 	lua_settop (L, top);


More information about the Commits mailing list