diff options
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | chrome/browser/process_singleton_win.cc | 7 |
2 files changed, 6 insertions, 2 deletions
@@ -33,3 +33,4 @@ Kim Christensen <kimworking@gmail.com> Paul Robinson <paulrobinson85@googlemail.com> Josué Ratelle <jorat1346@gmail.com> Edward Crossman <tedoc2000@gmail.com> +Nikita Ofitserov <himikof@gmail.com> diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc index 289e4d1..99d2d5f 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -169,14 +169,17 @@ LRESULT ProcessSingleton::OnCopyData(HWND hwnd, const COPYDATASTRUCT* cds) { return TRUE; // We should have enough room for the shortest command (min_message_size) - // and also be a multiple of wchar_t bytes. + // and also be a multiple of wchar_t bytes. The shortest command + // possible is L"START\0\0" (empty current directory and command line). static const int min_message_size = 7; - if (cds->cbData < min_message_size || cds->cbData % sizeof(wchar_t) != 0) { + if (cds->cbData < min_message_size * sizeof(wchar_t) || + cds->cbData % sizeof(wchar_t) != 0) { LOG(WARNING) << "Invalid WM_COPYDATA, length = " << cds->cbData; return TRUE; } // We split the string into 4 parts on NULLs. + DCHECK(cds->lpData); const std::wstring msg(static_cast<wchar_t*>(cds->lpData), cds->cbData / sizeof(wchar_t)); const std::wstring::size_type first_null = msg.find_first_of(L'\0'); |