summaryrefslogtreecommitdiffstats
path: root/base/logging.cc
diff options
context:
space:
mode:
authorgrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-20 01:33:32 +0000
committergrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-20 01:33:32 +0000
commit6ac3df5ed73f0ba6762df74f7ccf270f6db2ef2c (patch)
treef9c07b0581f3cb84ab03e33d96a67d4e9f547605 /base/logging.cc
parent33253151fc54626224cd40cf9435ebe1c0cbd53e (diff)
downloadchromium_src-6ac3df5ed73f0ba6762df74f7ccf270f6db2ef2c.zip
chromium_src-6ac3df5ed73f0ba6762df74f7ccf270f6db2ef2c.tar.gz
chromium_src-6ac3df5ed73f0ba6762df74f7ccf270f6db2ef2c.tar.bz2
Two minor changes to the use of FormatMessageA in Win32ErrorLogMessage:
- Follow the MSDN advice and use FORMAT_MESSAGE_IGNORE_INSERTS to avoid security issues and to prevent getting back ERROR_INVALID_PARAMETER for any message that has inserts. This is always the right thing since this function provides no arguments for inserts. - Don't specify a language identifier, thereby allowing FormatMessageA to make many sensible attempts to find a string in some suitable language. BUG=none TEST=none Review URL: http://codereview.chromium.org/3888001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63166 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/logging.cc')
-rw-r--r--base/logging.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/base/logging.cc b/base/logging.cc
index dfe9b0a..273162f 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -706,7 +706,7 @@ Win32ErrorLogMessage::Win32ErrorLogMessage(const char* file,
Win32ErrorLogMessage::~Win32ErrorLogMessage() {
const int error_message_buffer_size = 256;
char msgbuf[error_message_buffer_size];
- DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM;
+ DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS;
HMODULE hmod;
if (module_) {
hmod = GetModuleHandleA(module_);
@@ -725,7 +725,7 @@ Win32ErrorLogMessage::~Win32ErrorLogMessage() {
DWORD len = FormatMessageA(flags,
hmod,
err_,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ 0,
msgbuf,
sizeof(msgbuf) / sizeof(msgbuf[0]),
NULL);