Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1846)

Side by Side Diff: chrome_frame/chrome_tab.cc

Issue 8418034: Make string_util::WriteInto() DCHECK() that the supplied |length_with_null| > 1, meaning that the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // chrome_tab.cc : Implementation of DLL Exports. 5 // chrome_tab.cc : Implementation of DLL Exports.
6 6
7 // Need to include this before the ATL headers below. 7 // Need to include this before the ATL headers below.
8 #include "chrome_frame/chrome_tab.h" 8 #include "chrome_frame/chrome_tab.h"
9 9
10 #include <atlsecurity.h> 10 #include <atlsecurity.h>
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 // Read SDDL string from backup key 460 // Read SDDL string from backup key
461 bool ReadBackupKey(std::wstring* sddl) { 461 bool ReadBackupKey(std::wstring* sddl) {
462 RegKey backup_key(HKEY_LOCAL_MACHINE, backup_key_name_.c_str(), KEY_READ); 462 RegKey backup_key(HKEY_LOCAL_MACHINE, backup_key_name_.c_str(), KEY_READ);
463 if (!backup_key.Valid()) 463 if (!backup_key.Valid())
464 return false; 464 return false;
465 465
466 DWORD len = 0; 466 DWORD len = 0;
467 DWORD reg_type = REG_NONE; 467 DWORD reg_type = REG_NONE;
468 if (backup_key.ReadValue(NULL, NULL, &len, &reg_type) != ERROR_SUCCESS) 468 if (backup_key.ReadValue(NULL, NULL, &len, &reg_type) != ERROR_SUCCESS)
469 return false; 469 return false;
470 DCHECK_EQ(0u, len % sizeof(wchar_t));
470 471
471 if (reg_type != REG_SZ) 472 if ((len == 0) || (reg_type != REG_SZ))
472 return false; 473 return false;
473 474
474 size_t wchar_count = 1 + len / sizeof(wchar_t); 475 size_t wchar_count = 1 + len / sizeof(wchar_t);
475 if (backup_key.ReadValue(NULL, WriteInto(sddl, wchar_count), &len, 476 if (backup_key.ReadValue(NULL, WriteInto(sddl, wchar_count), &len,
476 &reg_type) != ERROR_SUCCESS) { 477 &reg_type) != ERROR_SUCCESS) {
477 return false; 478 return false;
478 } 479 }
479 480
480 return true; 481 return true;
481 } 482 }
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 HRESULT hr = CustomRegistration(ALL, FALSE, false); 917 HRESULT hr = CustomRegistration(ALL, FALSE, false);
917 return hr; 918 return hr;
918 } 919 }
919 920
920 // Object entries go here instead of with each object, so that we can move 921 // Object entries go here instead of with each object, so that we can move
921 // the objects to a lib. Also reduces magic. 922 // the objects to a lib. Also reduces magic.
922 OBJECT_ENTRY_AUTO(CLSID_ChromeFrameBHO, Bho) 923 OBJECT_ENTRY_AUTO(CLSID_ChromeFrameBHO, Bho)
923 OBJECT_ENTRY_AUTO(__uuidof(ChromeActiveDocument), ChromeActiveDocument) 924 OBJECT_ENTRY_AUTO(__uuidof(ChromeActiveDocument), ChromeActiveDocument)
924 OBJECT_ENTRY_AUTO(__uuidof(ChromeFrame), ChromeFrameActivex) 925 OBJECT_ENTRY_AUTO(__uuidof(ChromeFrame), ChromeFrameActivex)
925 OBJECT_ENTRY_AUTO(__uuidof(ChromeProtocol), ChromeProtocol) 926 OBJECT_ENTRY_AUTO(__uuidof(ChromeProtocol), ChromeProtocol)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698