diff options
-rw-r--r-- | base/clipboard_util.cc | 3 | ||||
-rw-r--r-- | chrome/common/os_exchange_data.cc | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/base/clipboard_util.cc b/base/clipboard_util.cc index 9d35db4..5902b43 100644 --- a/base/clipboard_util.cc +++ b/base/clipboard_util.cc @@ -356,7 +356,8 @@ bool ClipboardUtil::GetFileContents(IDataObject* data_object, if (SUCCEEDED(data_object->GetData(GetFileContentFormatZero(), &content))) { if (TYMED_HGLOBAL == content.tymed) { ScopedHGlobal<char> data(content.hGlobal); - file_contents->assign(data.get(), data.Size()); + // The size includes the trailing NULL byte. We don't want it. + file_contents->assign(data.get(), data.Size() - 1); } ReleaseStgMedium(&content); } diff --git a/chrome/common/os_exchange_data.cc b/chrome/common/os_exchange_data.cc index 36553c1..ea050de 100644 --- a/chrome/common/os_exchange_data.cc +++ b/chrome/common/os_exchange_data.cc @@ -330,7 +330,7 @@ void OSExchangeData::SetFileContents(const std::wstring& filename, ClipboardUtil::GetFileDescriptorFormat()->cfFormat, storage)); // Add CFSTR_FILECONTENTS - storage = GetStorageForBytes(file_contents.data(), file_contents.length()); + storage = GetStorageForString(file_contents); contents_.push_back(new StoredDataInfo( ClipboardUtil::GetFileContentFormatZero()->cfFormat, storage)); } |