chiark / gitweb /
Revert "Replace use of snprintf with xsprintf"
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 22 Feb 2018 21:03:15 +0000 (22:03 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:59:04 +0000 (07:59 +0200)
This reverts commit a7419dbc59da5c8cc9e90b3d96bc947cad91ae16.

_All_ changes in that commit were wrong.

Fixes #8211.

src/basic/log.c

index c0117f692442e4aaab5ad238c653a56b5025a687..1c8f6ec66b6f3d5a0f687b748ae07cabf1437e99 100644 (file)
@@ -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;