]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Avoid buffer overflow when printing long lua strings
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 26 Apr 2019 15:16:54 +0000 (16:16 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 26 Apr 2019 15:16:54 +0000 (16:16 +0100)
src/lua/lua_logger.c

index 67b70eaad0ecb21cd4896364913e161d71a54674..9d25fce6a180faf6149a361c73bfae14977e544d 100644 (file)
@@ -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);