From: Zbigniew Jędrzejewski-Szmek Date: Thu, 22 Feb 2018 21:03:15 +0000 (+0100) Subject: Revert "Replace use of snprintf with xsprintf" X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=724b3357d908de72253f0b93eb41f0b4ac5df66d;p=elogind.git Revert "Replace use of snprintf with xsprintf" This reverts commit a7419dbc59da5c8cc9e90b3d96bc947cad91ae16. _All_ changes in that commit were wrong. Fixes #8211. --- diff --git a/src/basic/log.c b/src/basic/log.c index c0117f692..1c8f6ec66 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -377,7 +377,7 @@ static int write_to_console( highlight = LOG_PRI(level) <= LOG_ERR && show_color; if (show_location) { - xsprintf(location, "(%s:%i) ", file, line); + snprintf(location, sizeof(location), "(%s:%i) ", file, line); iovec[n++] = IOVEC_MAKE_STRING(location); } @@ -816,7 +816,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;