summaryrefslogtreecommitdiffstats
path: root/chrome/app/breakpad_linux.cc
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 23:07:34 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 23:07:34 +0000
commit2eb41e766aeee36207576631717c3bfc586ad5ec (patch)
treef68b9c7f828c5f2f7c56efc53c8f5d9229c38a30 /chrome/app/breakpad_linux.cc
parent9c8ae2730a8da2aa7fbeaf843754fb731d6f7334 (diff)
downloadchromium_src-2eb41e766aeee36207576631717c3bfc586ad5ec.zip
chromium_src-2eb41e766aeee36207576631717c3bfc586ad5ec.tar.gz
chromium_src-2eb41e766aeee36207576631717c3bfc586ad5ec.tar.bz2
Make Linux crash death signal message constant sized.
BUG=none TEST=none Review URL: http://codereview.chromium.org/149709 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20803 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/breakpad_linux.cc')
-rw-r--r--chrome/app/breakpad_linux.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/chrome/app/breakpad_linux.cc b/chrome/app/breakpad_linux.cc
index 6f73d81..beaae2c 100644
--- a/chrome/app/breakpad_linux.cc
+++ b/chrome/app/breakpad_linux.cc
@@ -2,11 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/app/breakpad_linux.h"
+
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <unistd.h>
+#include <algorithm>
#include <string>
#include "base/command_line.h"
@@ -480,6 +483,14 @@ RendererCrashHandler(const void* crash_context, size_t crash_context_size,
const int fd = (int) context;
int fds[2];
socketpair(AF_UNIX, SOCK_STREAM, 0, fds);
+ char guid[kGuidSize] = {0};
+ char crash_url[kMaxActiveURLSize + 1] = {0};
+ const unsigned guid_len = std::min(google_update::linux_guid.size(),
+ kGuidSize);
+ const unsigned crash_url_len =
+ std::min(child_process_logging::active_url.size(), kMaxActiveURLSize);
+ memcpy(guid, google_update::linux_guid.data(), guid_len);
+ memcpy(crash_url, child_process_logging::active_url.data(), crash_url_len);
// The length of the control message:
static const unsigned kControlMsgSize = CMSG_SPACE(sizeof(int));
@@ -489,10 +500,10 @@ RendererCrashHandler(const void* crash_context, size_t crash_context_size,
struct kernel_iovec iov[3];
iov[0].iov_base = const_cast<void*>(crash_context);
iov[0].iov_len = crash_context_size;
- iov[1].iov_base = const_cast<char*>(google_update::linux_guid.data());
- iov[1].iov_len = google_update::linux_guid.size();
- iov[2].iov_base = const_cast<char*>(child_process_logging::active_url.data());
- iov[2].iov_len = child_process_logging::active_url.size();
+ iov[1].iov_base = guid;
+ iov[1].iov_len = kGuidSize + 1;
+ iov[2].iov_base = crash_url;
+ iov[2].iov_len = kMaxActiveURLSize + 1;
msg.msg_iov = iov;
msg.msg_iovlen = 3;