From: Zbigniew Jędrzejewski-Szmek Date: Thu, 3 Nov 2016 02:02:46 +0000 (-0400) Subject: Revert some uses of xsprintf X-Git-Tag: v232.2~16 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=5b9a4d1cfe8bbff9ec6fee00acab3f837613fa2c;hp=029a8d2f1459579593cf2fb6f62e5bba360b0a03;p=elogind.git Revert some uses of xsprintf 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. --- diff --git a/src/basic/log.c b/src/basic/log.c index 321c1bd20..d84c9bf11 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -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;