chiark / gitweb /
Revert some uses of xsprintf
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 3 Nov 2016 02:02:46 +0000 (22:02 -0400)
committerSven Eden <yamakuzure@gmx.net>
Wed, 5 Jul 2017 06:50:56 +0000 (08:50 +0200)
This reverts some changes introduced in d054f0a4d4.
xsprintf should be used in cases where we calculated the right buffer
size by hand (using DECIMAL_STRING_MAX and such), and never in cases where
we are printing externally specified strings of arbitrary length.

Fixes #4534.

src/basic/log.c

index 321c1bd20ee62ee1f79021651bc1671fa1c12e45..d84c9bf116b43c88d239079663e4e9f3ed235385 100644 (file)
@@ -798,7 +798,7 @@ static void log_assert(
                 return;
 
         DISABLE_WARNING_FORMAT_NONLITERAL;
-        xsprintf(buffer, format, text, file, line, func);
+        snprintf(buffer, sizeof buffer, format, text, file, line, func);
         REENABLE_WARNING;
 
         log_abort_msg = buffer;