From: Vsevolod Stakhov Date: Mon, 8 Jan 2018 20:52:29 +0000 (+0000) Subject: [Minor] Honor string length in logger X-Git-Tag: 1.7.0~303 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e0d4da6e21550abd7a491699d74e564b52318bff;p=rspamd.git [Minor] Honor string length in logger --- diff --git a/src/lua/lua_logger.c b/src/lua/lua_logger.c index 25dc07712..da950030d 100644 --- a/src/lua/lua_logger.c +++ b/src/lua/lua_logger.c @@ -248,11 +248,12 @@ lua_logger_debug (lua_State *L) static gsize lua_logger_out_str (lua_State *L, gint pos, gchar *outbuf, gsize len) { - const gchar *str = lua_tostring (L, pos); + gsize slen; + const gchar *str = lua_tolstring (L, pos, &slen); gsize r = 0; if (str) { - r = rspamd_strlcpy (outbuf, str, len + 1); + r = rspamd_strlcpy (outbuf, str, MIN (slen, len) + 1); } return r;