diff options
author | dcheng <dcheng@chromium.org> | 2015-07-02 10:13:33 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-02 17:14:12 +0000 |
commit | 9d02fb0d79f255dbaf8e8613ee829d8875ae561d (patch) | |
tree | d31c2b9e3ae396fa889a5f7df0515dbe0c3e9b04 | |
parent | 30a727d5ca1914eec9c2d1cf819affa6ecf881f3 (diff) | |
download | chromium_src-9d02fb0d79f255dbaf8e8613ee829d8875ae561d.zip chromium_src-9d02fb0d79f255dbaf8e8613ee829d8875ae561d.tar.gz chromium_src-9d02fb0d79f255dbaf8e8613ee829d8875ae561d.tar.bz2 |
Fix some clang warnings with -Wmissing-braces in sandbox.
Clang warns if there are missing braces around a subobject
initializer. The most common idiom that triggers this is:
STRUCT s = {0};
if the first field of STRUCT is itself a struct. This can
be more simply written as:
STRUCT s = {};
which also prevents the warning from firing.
BUG=505297
Review URL: https://codereview.chromium.org/1216243007
Cr-Commit-Position: refs/heads/master@{#337237}
-rw-r--r-- | sandbox/win/sandbox_poc/pocdll/handles.cc | 2 | ||||
-rw-r--r-- | sandbox/win/src/file_policy_test.cc | 33 | ||||
-rw-r--r-- | sandbox/win/src/filesystem_dispatcher.cc | 44 | ||||
-rw-r--r-- | sandbox/win/src/filesystem_policy.cc | 12 | ||||
-rw-r--r-- | sandbox/win/src/handle_dispatcher.cc | 8 | ||||
-rw-r--r-- | sandbox/win/src/ipc_unittest.cc | 16 | ||||
-rw-r--r-- | sandbox/win/src/job.cc | 4 | ||||
-rw-r--r-- | sandbox/win/src/named_pipe_dispatcher.cc | 13 | ||||
-rw-r--r-- | sandbox/win/src/process_mitigations.cc | 8 | ||||
-rw-r--r-- | sandbox/win/src/process_thread_dispatcher.cc | 36 | ||||
-rw-r--r-- | sandbox/win/src/registry_dispatcher.cc | 17 | ||||
-rw-r--r-- | sandbox/win/src/restricted_token_utils.cc | 2 | ||||
-rw-r--r-- | sandbox/win/src/sandbox_policy_base.cc | 4 | ||||
-rw-r--r-- | sandbox/win/src/sync_dispatcher.cc | 10 |
14 files changed, 104 insertions, 105 deletions
diff --git a/sandbox/win/sandbox_poc/pocdll/handles.cc b/sandbox/win/sandbox_poc/pocdll/handles.cc index a12d433..1c6116e 100644 --- a/sandbox/win/sandbox_poc/pocdll/handles.cc +++ b/sandbox/win/sandbox_poc/pocdll/handles.cc @@ -120,7 +120,7 @@ void POCDLL_API TestGetHandle(HANDLE log) { // iterate and always increase the buffer size until the function // succeeds. (Or at least does not fail with STATUS_BUFFER_OVERFLOW) ULONG size_file = MAX_PATH; - IO_STATUS_BLOCK status_block = {0}; + IO_STATUS_BLOCK status_block = {}; do { // Delete the previous buffer create. The buffer was too small if (file_name) { diff --git a/sandbox/win/src/file_policy_test.cc b/sandbox/win/src/file_policy_test.cc index 8b52362..9d0f688 100644 --- a/sandbox/win/src/file_policy_test.cc +++ b/sandbox/win/src/file_policy_test.cc @@ -116,12 +116,12 @@ SBOX_TESTS_COMMAND int File_CreateSys32(int argc, wchar_t **argv) { UNICODE_STRING object_name; RtlInitUnicodeString(&object_name, file.c_str()); - OBJECT_ATTRIBUTES obj_attributes = {0}; + OBJECT_ATTRIBUTES obj_attributes = {}; InitializeObjectAttributes(&obj_attributes, &object_name, OBJ_CASE_INSENSITIVE, NULL, NULL); HANDLE handle; - IO_STATUS_BLOCK io_block = {0}; + IO_STATUS_BLOCK io_block = {}; NTSTATUS status = NtCreateFile(&handle, FILE_READ_DATA, &obj_attributes, &io_block, NULL, 0, kSharing, FILE_OPEN, 0, NULL, 0); @@ -151,12 +151,12 @@ SBOX_TESTS_COMMAND int File_OpenSys32(int argc, wchar_t **argv) { UNICODE_STRING object_name; RtlInitUnicodeString(&object_name, file.c_str()); - OBJECT_ATTRIBUTES obj_attributes = {0}; + OBJECT_ATTRIBUTES obj_attributes = {}; InitializeObjectAttributes(&obj_attributes, &object_name, OBJ_CASE_INSENSITIVE, NULL, NULL); HANDLE handle; - IO_STATUS_BLOCK io_block = {0}; + IO_STATUS_BLOCK io_block = {}; NTSTATUS status = NtOpenFile(&handle, FILE_READ_DATA, &obj_attributes, &io_block, kSharing, 0); if (NT_SUCCESS(status)) { @@ -175,9 +175,9 @@ SBOX_TESTS_COMMAND int File_GetDiskSpace(int argc, wchar_t **argv) { if (sys_path.empty()) { return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; } - ULARGE_INTEGER free_user = {0}; - ULARGE_INTEGER total = {0}; - ULARGE_INTEGER free_total = {0}; + ULARGE_INTEGER free_user = {}; + ULARGE_INTEGER total = {}; + ULARGE_INTEGER free_total = {}; if (::GetDiskFreeSpaceExW(sys_path.c_str(), &free_user, &total, &free_total)) { if ((total.QuadPart != 0) && (free_total.QuadPart !=0)) { @@ -230,12 +230,12 @@ SBOX_TESTS_COMMAND int File_QueryAttributes(int argc, wchar_t **argv) { base::string16 file = MakePathToSys(argv[0], true); RtlInitUnicodeString(&object_name, file.c_str()); - OBJECT_ATTRIBUTES obj_attributes = {0}; + OBJECT_ATTRIBUTES obj_attributes = {}; InitializeObjectAttributes(&obj_attributes, &object_name, OBJ_CASE_INSENSITIVE, NULL, NULL); - FILE_BASIC_INFORMATION info = {0}; - FILE_NETWORK_OPEN_INFORMATION full_info = {0}; + FILE_BASIC_INFORMATION info = {}; + FILE_NETWORK_OPEN_INFORMATION full_info = {}; NTSTATUS status1 = NtQueryAttributesFile(&obj_attributes, &info); NTSTATUS status2 = NtQueryFullAttributesFile(&obj_attributes, &full_info); @@ -310,12 +310,12 @@ TEST(FilePolicyTest, AllowReadOnly) { EXPECT_TRUE(runner.AddFsRule(TargetPolicy::FILES_ALLOW_READONLY, temp_file_name)); - wchar_t command_read[MAX_PATH + 20] = {0}; + wchar_t command_read[MAX_PATH + 20] = {}; wsprintf(command_read, L"File_Create Read \"%ls\"", temp_file_name); - wchar_t command_read_create[MAX_PATH + 20] = {0}; + wchar_t command_read_create[MAX_PATH + 20] = {}; wsprintf(command_read_create, L"File_Create ReadCreate \"%ls\"", temp_file_name); - wchar_t command_write[MAX_PATH + 20] = {0}; + wchar_t command_write[MAX_PATH + 20] = {}; wsprintf(command_write, L"File_Create Write \"%ls\"", temp_file_name); // Verify that we cannot create the file after revert. @@ -351,7 +351,7 @@ TEST(FilePolicyTest, AllowImplicitDeviceName) { EXPECT_TRUE(GetNtPathFromWin32Path(path, &path)); path = path.substr(sandbox::kNTDevicePrefixLen); - wchar_t command[MAX_PATH + 20] = {0}; + wchar_t command[MAX_PATH + 20] = {}; wsprintf(command, L"File_Create Read \"\\\\.\\%ls\"", path.c_str()); path = std::wstring(kNTPrefix) + path; @@ -374,7 +374,7 @@ TEST(FilePolicyTest, AllowWildcard) { wcscat_s(temp_directory, MAX_PATH, L"*"); EXPECT_TRUE(runner.AddFsRule(TargetPolicy::FILES_ALLOW_ANY, temp_directory)); - wchar_t command_write[MAX_PATH + 20] = {0}; + wchar_t command_write[MAX_PATH + 20] = {}; wsprintf(command_write, L"File_Create Write \"%ls\"", temp_file_name); // Verify that we have write access after revert. @@ -494,8 +494,7 @@ TEST(FilePolicyTest, TestRename) { ::DeleteFile(temp_file_name6); ::DeleteFile(temp_file_name8); - - wchar_t command[MAX_PATH*2 + 20] = {0}; + wchar_t command[MAX_PATH * 2 + 20] = {}; wsprintf(command, L"File_Rename \"%ls\" \"%ls\"", temp_file_name1, temp_file_name2); EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(command)); diff --git a/sandbox/win/src/filesystem_dispatcher.cc b/sandbox/win/src/filesystem_dispatcher.cc index 4561be4..b6da10d 100644 --- a/sandbox/win/src/filesystem_dispatcher.cc +++ b/sandbox/win/src/filesystem_dispatcher.cc @@ -20,35 +20,37 @@ namespace sandbox { FilesystemDispatcher::FilesystemDispatcher(PolicyBase* policy_base) : policy_base_(policy_base) { static const IPCCall create_params = { - {IPC_NTCREATEFILE_TAG, WCHAR_TYPE, UINT32_TYPE, UINT32_TYPE, UINT32_TYPE, - UINT32_TYPE, UINT32_TYPE, UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>(&FilesystemDispatcher::NtCreateFile) - }; + {IPC_NTCREATEFILE_TAG, + {WCHAR_TYPE, + UINT32_TYPE, + UINT32_TYPE, + UINT32_TYPE, + UINT32_TYPE, + UINT32_TYPE, + UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>(&FilesystemDispatcher::NtCreateFile)}; static const IPCCall open_file = { - {IPC_NTOPENFILE_TAG, WCHAR_TYPE, UINT32_TYPE, UINT32_TYPE, UINT32_TYPE, - UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>(&FilesystemDispatcher::NtOpenFile) - }; + {IPC_NTOPENFILE_TAG, + {WCHAR_TYPE, UINT32_TYPE, UINT32_TYPE, UINT32_TYPE, UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>(&FilesystemDispatcher::NtOpenFile)}; static const IPCCall attribs = { - {IPC_NTQUERYATTRIBUTESFILE_TAG, WCHAR_TYPE, UINT32_TYPE, INOUTPTR_TYPE}, - reinterpret_cast<CallbackGeneric>( - &FilesystemDispatcher::NtQueryAttributesFile) - }; + {IPC_NTQUERYATTRIBUTESFILE_TAG, {WCHAR_TYPE, UINT32_TYPE, INOUTPTR_TYPE}}, + reinterpret_cast<CallbackGeneric>( + &FilesystemDispatcher::NtQueryAttributesFile)}; static const IPCCall full_attribs = { - {IPC_NTQUERYFULLATTRIBUTESFILE_TAG, WCHAR_TYPE, UINT32_TYPE, INOUTPTR_TYPE}, - reinterpret_cast<CallbackGeneric>( - &FilesystemDispatcher::NtQueryFullAttributesFile) - }; + {IPC_NTQUERYFULLATTRIBUTESFILE_TAG, + {WCHAR_TYPE, UINT32_TYPE, INOUTPTR_TYPE}}, + reinterpret_cast<CallbackGeneric>( + &FilesystemDispatcher::NtQueryFullAttributesFile)}; static const IPCCall set_info = { - {IPC_NTSETINFO_RENAME_TAG, VOIDPTR_TYPE, INOUTPTR_TYPE, INOUTPTR_TYPE, - UINT32_TYPE, UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>( - &FilesystemDispatcher::NtSetInformationFile) - }; + {IPC_NTSETINFO_RENAME_TAG, + {VOIDPTR_TYPE, INOUTPTR_TYPE, INOUTPTR_TYPE, UINT32_TYPE, UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>( + &FilesystemDispatcher::NtSetInformationFile)}; ipc_calls_.push_back(create_params); ipc_calls_.push_back(open_file); diff --git a/sandbox/win/src/filesystem_policy.cc b/sandbox/win/src/filesystem_policy.cc index 0349ff3..2c3f703 100644 --- a/sandbox/win/src/filesystem_policy.cc +++ b/sandbox/win/src/filesystem_policy.cc @@ -255,9 +255,9 @@ bool FileSystemPolicy::CreateFileAction(EvalResult eval_result, *nt_status = STATUS_ACCESS_DENIED; return false; } - IO_STATUS_BLOCK io_block = {0}; - UNICODE_STRING uni_name = {0}; - OBJECT_ATTRIBUTES obj_attributes = {0}; + IO_STATUS_BLOCK io_block = {}; + UNICODE_STRING uni_name = {}; + OBJECT_ATTRIBUTES obj_attributes = {}; SECURITY_QUALITY_OF_SERVICE security_qos = GetAnonymousQOS(); InitObjectAttribs(file, attributes, NULL, &obj_attributes, @@ -289,9 +289,9 @@ bool FileSystemPolicy::OpenFileAction(EvalResult eval_result, } // An NtOpen is equivalent to an NtCreate with FileAttributes = 0 and // CreateDisposition = FILE_OPEN. - IO_STATUS_BLOCK io_block = {0}; - UNICODE_STRING uni_name = {0}; - OBJECT_ATTRIBUTES obj_attributes = {0}; + IO_STATUS_BLOCK io_block = {}; + UNICODE_STRING uni_name = {}; + OBJECT_ATTRIBUTES obj_attributes = {}; SECURITY_QUALITY_OF_SERVICE security_qos = GetAnonymousQOS(); InitObjectAttribs(file, attributes, NULL, &obj_attributes, diff --git a/sandbox/win/src/handle_dispatcher.cc b/sandbox/win/src/handle_dispatcher.cc index 66308f4..fb640ba 100644 --- a/sandbox/win/src/handle_dispatcher.cc +++ b/sandbox/win/src/handle_dispatcher.cc @@ -20,10 +20,10 @@ namespace sandbox { HandleDispatcher::HandleDispatcher(PolicyBase* policy_base) : policy_base_(policy_base) { static const IPCCall duplicate_handle_proxy = { - {IPC_DUPLICATEHANDLEPROXY_TAG, VOIDPTR_TYPE, UINT32_TYPE, UINT32_TYPE, - UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>(&HandleDispatcher::DuplicateHandleProxy) - }; + {IPC_DUPLICATEHANDLEPROXY_TAG, + {VOIDPTR_TYPE, UINT32_TYPE, UINT32_TYPE, UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>( + &HandleDispatcher::DuplicateHandleProxy)}; ipc_calls_.push_back(duplicate_handle_proxy); } diff --git a/sandbox/win/src/ipc_unittest.cc b/sandbox/win/src/ipc_unittest.cc index b1e74ab..ddad9b42 100644 --- a/sandbox/win/src/ipc_unittest.cc +++ b/sandbox/win/src/ipc_unittest.cc @@ -584,16 +584,12 @@ class UnitTestIPCDispatcher : public Dispatcher { }; UnitTestIPCDispatcher::UnitTestIPCDispatcher() { - static const IPCCall call_one = { - {CALL_ONE_TAG, VOIDPTR_TYPE, UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>( - &UnitTestIPCDispatcher::CallOneHandler) - }; - static const IPCCall call_two = { - {CALL_TWO_TAG, VOIDPTR_TYPE, UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>( - &UnitTestIPCDispatcher::CallTwoHandler) - }; + static const IPCCall call_one = {{CALL_ONE_TAG, {VOIDPTR_TYPE, UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>( + &UnitTestIPCDispatcher::CallOneHandler)}; + static const IPCCall call_two = {{CALL_TWO_TAG, {VOIDPTR_TYPE, UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>( + &UnitTestIPCDispatcher::CallTwoHandler)}; ipc_calls_.push_back(call_one); ipc_calls_.push_back(call_two); } diff --git a/sandbox/win/src/job.cc b/sandbox/win/src/job.cc index 8852ab0..c370808 100644 --- a/sandbox/win/src/job.cc +++ b/sandbox/win/src/job.cc @@ -26,8 +26,8 @@ DWORD Job::Init(JobLevel security_level, if (!job_handle_) return ::GetLastError(); - JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = {0}; - JOBOBJECT_BASIC_UI_RESTRICTIONS jbur = {0}; + JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = {}; + JOBOBJECT_BASIC_UI_RESTRICTIONS jbur = {}; // Set the settings for the different security levels. Note: The higher levels // inherit from the lower levels. diff --git a/sandbox/win/src/named_pipe_dispatcher.cc b/sandbox/win/src/named_pipe_dispatcher.cc index 5527319..6bf982a 100644 --- a/sandbox/win/src/named_pipe_dispatcher.cc +++ b/sandbox/win/src/named_pipe_dispatcher.cc @@ -23,10 +23,15 @@ namespace sandbox { NamedPipeDispatcher::NamedPipeDispatcher(PolicyBase* policy_base) : policy_base_(policy_base) { static const IPCCall create_params = { - {IPC_CREATENAMEDPIPEW_TAG, WCHAR_TYPE, UINT32_TYPE, UINT32_TYPE, - UINT32_TYPE, UINT32_TYPE, UINT32_TYPE, UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>(&NamedPipeDispatcher::CreateNamedPipe) - }; + {IPC_CREATENAMEDPIPEW_TAG, + {WCHAR_TYPE, + UINT32_TYPE, + UINT32_TYPE, + UINT32_TYPE, + UINT32_TYPE, + UINT32_TYPE, + UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>(&NamedPipeDispatcher::CreateNamedPipe)}; ipc_calls_.push_back(create_params); } diff --git a/sandbox/win/src/process_mitigations.cc b/sandbox/win/src/process_mitigations.cc index d187c55..8963fc8 100644 --- a/sandbox/win/src/process_mitigations.cc +++ b/sandbox/win/src/process_mitigations.cc @@ -122,7 +122,7 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) { // Enable ASLR policies. if (flags & MITIGATION_RELOCATE_IMAGE) { - PROCESS_MITIGATION_ASLR_POLICY policy = { 0 }; + PROCESS_MITIGATION_ASLR_POLICY policy = {}; policy.EnableForceRelocateImages = true; policy.DisallowStrippedImages = (flags & MITIGATION_RELOCATE_IMAGE_REQUIRED) == @@ -137,7 +137,7 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) { // Enable strict handle policies. if (flags & MITIGATION_STRICT_HANDLE_CHECKS) { - PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY policy = { 0 }; + PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY policy = {}; policy.HandleExceptionsPermanentlyEnabled = policy.RaiseExceptionOnInvalidHandleReference = true; @@ -150,7 +150,7 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) { // Enable system call policies. if (flags & MITIGATION_WIN32K_DISABLE) { - PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY policy = { 0 }; + PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY policy = {}; policy.DisallowWin32kSystemCalls = true; if (!set_process_mitigation_policy(ProcessSystemCallDisablePolicy, &policy, @@ -162,7 +162,7 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) { // Enable system call policies. if (flags & MITIGATION_EXTENSION_DLL_DISABLE) { - PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY policy = { 0 }; + PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY policy = {}; policy.DisableExtensionPoints = true; if (!set_process_mitigation_policy(ProcessExtensionPointDisablePolicy, diff --git a/sandbox/win/src/process_thread_dispatcher.cc b/sandbox/win/src/process_thread_dispatcher.cc index ca17d49..90cad63 100644 --- a/sandbox/win/src/process_thread_dispatcher.cc +++ b/sandbox/win/src/process_thread_dispatcher.cc @@ -97,34 +97,30 @@ namespace sandbox { ThreadProcessDispatcher::ThreadProcessDispatcher(PolicyBase* policy_base) : policy_base_(policy_base) { static const IPCCall open_thread = { - {IPC_NTOPENTHREAD_TAG, UINT32_TYPE, UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>( - &ThreadProcessDispatcher::NtOpenThread) - }; + {IPC_NTOPENTHREAD_TAG, {UINT32_TYPE, UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>( + &ThreadProcessDispatcher::NtOpenThread)}; static const IPCCall open_process = { - {IPC_NTOPENPROCESS_TAG, UINT32_TYPE, UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>( - &ThreadProcessDispatcher::NtOpenProcess) - }; + {IPC_NTOPENPROCESS_TAG, {UINT32_TYPE, UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>( + &ThreadProcessDispatcher::NtOpenProcess)}; static const IPCCall process_token = { - {IPC_NTOPENPROCESSTOKEN_TAG, VOIDPTR_TYPE, UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>( - &ThreadProcessDispatcher::NtOpenProcessToken) - }; + {IPC_NTOPENPROCESSTOKEN_TAG, {VOIDPTR_TYPE, UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>( + &ThreadProcessDispatcher::NtOpenProcessToken)}; static const IPCCall process_tokenex = { - {IPC_NTOPENPROCESSTOKENEX_TAG, VOIDPTR_TYPE, UINT32_TYPE, UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>( - &ThreadProcessDispatcher::NtOpenProcessTokenEx) - }; + {IPC_NTOPENPROCESSTOKENEX_TAG, {VOIDPTR_TYPE, UINT32_TYPE, UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>( + &ThreadProcessDispatcher::NtOpenProcessTokenEx)}; static const IPCCall create_params = { - {IPC_CREATEPROCESSW_TAG, WCHAR_TYPE, WCHAR_TYPE, WCHAR_TYPE, INOUTPTR_TYPE}, - reinterpret_cast<CallbackGeneric>( - &ThreadProcessDispatcher::CreateProcessW) - }; + {IPC_CREATEPROCESSW_TAG, + {WCHAR_TYPE, WCHAR_TYPE, WCHAR_TYPE, INOUTPTR_TYPE}}, + reinterpret_cast<CallbackGeneric>( + &ThreadProcessDispatcher::CreateProcessW)}; ipc_calls_.push_back(open_thread); ipc_calls_.push_back(open_process); diff --git a/sandbox/win/src/registry_dispatcher.cc b/sandbox/win/src/registry_dispatcher.cc index 967fe65..267a592 100644 --- a/sandbox/win/src/registry_dispatcher.cc +++ b/sandbox/win/src/registry_dispatcher.cc @@ -42,15 +42,18 @@ namespace sandbox { RegistryDispatcher::RegistryDispatcher(PolicyBase* policy_base) : policy_base_(policy_base) { static const IPCCall create_params = { - {IPC_NTCREATEKEY_TAG, WCHAR_TYPE, UINT32_TYPE, VOIDPTR_TYPE, UINT32_TYPE, - UINT32_TYPE, UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>(&RegistryDispatcher::NtCreateKey) - }; + {IPC_NTCREATEKEY_TAG, + {WCHAR_TYPE, + UINT32_TYPE, + VOIDPTR_TYPE, + UINT32_TYPE, + UINT32_TYPE, + UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>(&RegistryDispatcher::NtCreateKey)}; static const IPCCall open_params = { - {IPC_NTOPENKEY_TAG, WCHAR_TYPE, UINT32_TYPE, VOIDPTR_TYPE, UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>(&RegistryDispatcher::NtOpenKey) - }; + {IPC_NTOPENKEY_TAG, {WCHAR_TYPE, UINT32_TYPE, VOIDPTR_TYPE, UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>(&RegistryDispatcher::NtOpenKey)}; ipc_calls_.push_back(create_params); ipc_calls_.push_back(open_params); diff --git a/sandbox/win/src/restricted_token_utils.cc b/sandbox/win/src/restricted_token_utils.cc index 5e06daa..1745236 100644 --- a/sandbox/win/src/restricted_token_utils.cc +++ b/sandbox/win/src/restricted_token_utils.cc @@ -309,7 +309,7 @@ DWORD SetTokenIntegrityLevel(HANDLE token, IntegrityLevel integrity_level) { if (!::ConvertStringSidToSid(integrity_level_str, &integrity_sid)) return ::GetLastError(); - TOKEN_MANDATORY_LABEL label = {0}; + TOKEN_MANDATORY_LABEL label = {}; label.Label.Attributes = SE_GROUP_INTEGRITY; label.Label.Sid = integrity_sid; diff --git a/sandbox/win/src/sandbox_policy_base.cc b/sandbox/win/src/sandbox_policy_base.cc index 07a7d09..6df2cb3 100644 --- a/sandbox/win/src/sandbox_policy_base.cc +++ b/sandbox/win/src/sandbox_policy_base.cc @@ -501,8 +501,8 @@ void PolicyBase::ClearSharedHandles() { Dispatcher* PolicyBase::OnMessageReady(IPCParams* ipc, CallbackGeneric* callback) { DCHECK(callback); - static const IPCParams ping1 = {IPC_PING1_TAG, UINT32_TYPE}; - static const IPCParams ping2 = {IPC_PING2_TAG, INOUTPTR_TYPE}; + static const IPCParams ping1 = {IPC_PING1_TAG, {UINT32_TYPE}}; + static const IPCParams ping2 = {IPC_PING2_TAG, {INOUTPTR_TYPE}}; if (ping1.Matches(ipc) || ping2.Matches(ipc)) { *callback = reinterpret_cast<CallbackGeneric>( diff --git a/sandbox/win/src/sync_dispatcher.cc b/sandbox/win/src/sync_dispatcher.cc index b83055d..a638d3d 100644 --- a/sandbox/win/src/sync_dispatcher.cc +++ b/sandbox/win/src/sync_dispatcher.cc @@ -20,14 +20,12 @@ namespace sandbox { SyncDispatcher::SyncDispatcher(PolicyBase* policy_base) : policy_base_(policy_base) { static const IPCCall create_params = { - {IPC_CREATEEVENT_TAG, WCHAR_TYPE, UINT32_TYPE, UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>(&SyncDispatcher::CreateEvent) - }; + {IPC_CREATEEVENT_TAG, {WCHAR_TYPE, UINT32_TYPE, UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>(&SyncDispatcher::CreateEvent)}; static const IPCCall open_params = { - {IPC_OPENEVENT_TAG, WCHAR_TYPE, UINT32_TYPE}, - reinterpret_cast<CallbackGeneric>(&SyncDispatcher::OpenEvent) - }; + {IPC_OPENEVENT_TAG, {WCHAR_TYPE, UINT32_TYPE}}, + reinterpret_cast<CallbackGeneric>(&SyncDispatcher::OpenEvent)}; ipc_calls_.push_back(create_params); ipc_calls_.push_back(open_params); |