Fix log format misuse

Harden log channel methods against non-constant string.
This commit is contained in:
Nekotekina 2019-10-09 02:14:52 +03:00
parent a29d4150df
commit 8f604ddded
4 changed files with 8 additions and 8 deletions

View File

@ -72,8 +72,8 @@ namespace logs
#define GEN_LOG_METHOD(_sev)\
const message msg_##_sev{this, level::_sev};\
template <typename... Args>\
void _sev(const char* fmt, const Args&... args)\
template <std::size_t N, typename... Args>\
void _sev(const char(&fmt)[N], const Args&... args)\
{\
if (UNLIKELY(level::_sev <= enabled))\
{\

View File

@ -209,11 +209,11 @@ error_code cellMsgDialogOpen2(u32 type, vm::cptr<char> msgString, vm::ptr<CellMs
if (_type.se_normal)
{
cellSysutil.warning(msgString.get_ptr());
cellSysutil.warning("%s", msgString);
}
else
{
cellSysutil.error(msgString.get_ptr());
cellSysutil.error("%s", msgString);
}
if (auto manager = g_fxo->get<rsx::overlays::display_manager>())

View File

@ -149,7 +149,7 @@ void pngDecEndCallback(png_structp png_ptr, png_infop info)
// Custom error handler for libpng
void pngDecError(png_structp png_ptr, png_const_charp error_message)
{
cellPngDec.error(error_message);
cellPngDec.error("%s", error_message);
// we can't return here or libpng blows up
throw LibPngCustomException("Fatal Error in libpng");
}
@ -157,7 +157,7 @@ void pngDecError(png_structp png_ptr, png_const_charp error_message)
// Custom warning handler for libpng
void pngDecWarning(png_structp png_ptr, png_const_charp error_message)
{
cellPngDec.warning(error_message);
cellPngDec.warning("%s", error_message);
}
// Get the chunk information of the PNG file. IDAT is marked as existing, only after decoding or reading the header.

View File

@ -257,7 +257,7 @@ bool gdb_thread::read_cmd(gdb_cmd& out_cmd)
}
catch (const std::runtime_error& e)
{
gdbDebugServer.error(e.what());
gdbDebugServer.error("%s", e.what());
return false;
}
}
@ -855,7 +855,7 @@ void gdb_thread::operator()()
client_socket = -1;
}
gdbDebugServer.error(e.what());
gdbDebugServer.error("%s", e.what());
}
}
}