OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // Note: any code in this file MUST be async-signal safe. | 5 // Note: any code in this file MUST be async-signal safe. |
6 | 6 |
7 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" | 7 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 const char* const values[] = { | 160 const char* const values[] = { |
161 nr.str(), | 161 nr.str(), |
162 arg1.str(), | 162 arg1.str(), |
163 arg2.str(), | 163 arg2.str(), |
164 arg3.str(), | 164 arg3.str(), |
165 arg4.str(), | 165 arg4.str(), |
166 }; | 166 }; |
167 | 167 |
168 size_t crash_key_length = nr.length() + arg1.length() + arg2.length() + | 168 size_t crash_key_length = nr.length() + arg1.length() + arg2.length() + |
169 arg3.length() + arg4.length(); | 169 arg3.length() + arg4.length(); |
170 for (const auto& prefix : prefixes) { | 170 for (auto* prefix : prefixes) { |
171 crash_key_length += strlen(prefix); | 171 crash_key_length += strlen(prefix); |
172 } | 172 } |
173 ++crash_key_length; // For the trailing NUL byte. | 173 ++crash_key_length; // For the trailing NUL byte. |
174 | 174 |
175 char crash_key[crash_key_length]; | 175 char crash_key[crash_key_length]; |
176 memset(crash_key, '\0', crash_key_length); | 176 memset(crash_key, '\0', crash_key_length); |
177 | 177 |
178 size_t offset = 0; | 178 size_t offset = 0; |
179 for (size_t i = 0; i < arraysize(values); ++i) { | 179 for (size_t i = 0; i < arraysize(values); ++i) { |
180 const char* strings[2] = { prefixes[i], values[i] }; | 180 const char* strings[2] = { prefixes[i], values[i] }; |
181 for (const auto& string : strings) { | 181 for (auto* string : strings) { |
182 size_t string_len = strlen(string); | 182 size_t string_len = strlen(string); |
183 memmove(&crash_key[offset], string, string_len); | 183 memmove(&crash_key[offset], string, string_len); |
184 offset += string_len; | 184 offset += string_len; |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 base::debug::SetCrashKeyValue("seccomp-sigsys", crash_key); | 188 base::debug::SetCrashKeyValue("seccomp-sigsys", crash_key); |
189 #endif | 189 #endif |
190 } | 190 } |
191 | 191 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 380 |
381 const char* GetKillErrorMessageContentForTests() { | 381 const char* GetKillErrorMessageContentForTests() { |
382 return SECCOMP_MESSAGE_KILL_CONTENT; | 382 return SECCOMP_MESSAGE_KILL_CONTENT; |
383 } | 383 } |
384 | 384 |
385 const char* GetFutexErrorMessageContentForTests() { | 385 const char* GetFutexErrorMessageContentForTests() { |
386 return SECCOMP_MESSAGE_FUTEX_CONTENT; | 386 return SECCOMP_MESSAGE_FUTEX_CONTENT; |
387 } | 387 } |
388 | 388 |
389 } // namespace sandbox. | 389 } // namespace sandbox. |
OLD | NEW |