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

Side by Side Diff: components/crash/app/breakpad_linux.cc

Issue 633833002: Breakpad Linux: Do not use std::string in a compromised context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix content shell too Created 6 years, 2 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 // For linux_syscall_support.h. This makes it safe to call embedded system 5 // For linux_syscall_support.h. This makes it safe to call embedded system
6 // calls when in seccomp mode. 6 // calls when in seccomp mode.
7 7
8 #include "components/crash/app/breakpad_linux.h" 8 #include "components/crash/app/breakpad_linux.h"
9 9
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 // Content-Type: application/octet-stream \r\n \r\n 1306 // Content-Type: application/octet-stream \r\n \r\n
1307 // <dump contents> 1307 // <dump contents>
1308 // \r\n BOUNDARY -- \r\n 1308 // \r\n BOUNDARY -- \r\n
1309 1309
1310 #if defined(OS_CHROMEOS) 1310 #if defined(OS_CHROMEOS)
1311 CrashReporterWriter writer(temp_file_fd); 1311 CrashReporterWriter writer(temp_file_fd);
1312 #else 1312 #else
1313 MimeWriter writer(temp_file_fd, mime_boundary); 1313 MimeWriter writer(temp_file_fd, mime_boundary);
1314 #endif 1314 #endif
1315 { 1315 {
1316 // TODO(thestig) Do not use this inside a compromised context. 1316 const char* product_name = "";
1317 std::string product_name; 1317 const char* version = "";
1318 std::string version;
1319 1318
1320 GetCrashReporterClient()->GetProductNameAndVersion(&product_name, &version); 1319 GetCrashReporterClient()->GetProductNameAndVersion(&product_name, &version);
1321 1320
1322 writer.AddBoundary(); 1321 writer.AddBoundary();
1323 writer.AddPairString("prod", product_name.c_str()); 1322 writer.AddPairString("prod", product_name);
1324 writer.AddBoundary(); 1323 writer.AddBoundary();
1325 writer.AddPairString("ver", version.c_str()); 1324 writer.AddPairString("ver", version);
1326 writer.AddBoundary(); 1325 writer.AddBoundary();
1327 if (info.pid > 0) { 1326 if (info.pid > 0) {
1328 char pid_value_buf[kUint64StringSize]; 1327 char pid_value_buf[kUint64StringSize];
1329 uint64_t pid_value_len = my_uint64_len(info.pid); 1328 uint64_t pid_value_len = my_uint64_len(info.pid);
1330 my_uint64tos(pid_value_buf, info.pid, pid_value_len); 1329 my_uint64tos(pid_value_buf, info.pid, pid_value_len);
1331 static const char pid_key_name[] = "pid"; 1330 static const char pid_key_name[] = "pid";
1332 writer.AddPairData(pid_key_name, sizeof(pid_key_name) - 1, 1331 writer.AddPairData(pid_key_name, sizeof(pid_key_name) - 1,
1333 pid_value_buf, pid_value_len); 1332 pid_value_buf, pid_value_len);
1334 writer.AddBoundary(); 1333 writer.AddBoundary();
1335 } 1334 }
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 } 1614 }
1616 } 1615 }
1617 } 1616 }
1618 #endif // OS_ANDROID 1617 #endif // OS_ANDROID
1619 1618
1620 bool IsCrashReporterEnabled() { 1619 bool IsCrashReporterEnabled() {
1621 return g_is_crash_reporter_enabled; 1620 return g_is_crash_reporter_enabled;
1622 } 1621 }
1623 1622
1624 } // namespace breakpad 1623 } // namespace breakpad
OLDNEW
« no previous file with comments | « chrome/app/chrome_crash_reporter_client.cc ('k') | components/crash/app/crash_reporter_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698