diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 18:41:02 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 18:41:02 +0000 |
commit | 52db4aa7aa9a340e8b142816aca9ad873f9c9043 (patch) | |
tree | 720af376d75e8b70017307a5cb6a40c3f50a5883 /chrome | |
parent | 7baa61a951bfa7ef8dde06bd20dace3cdc0efca7 (diff) | |
download | chromium_src-52db4aa7aa9a340e8b142816aca9ad873f9c9043.zip chromium_src-52db4aa7aa9a340e8b142816aca9ad873f9c9043.tar.gz chromium_src-52db4aa7aa9a340e8b142816aca9ad873f9c9043.tar.bz2 |
Remove trailing NULL is data sent between chrome processes.
Since we split on NULL, the final NULL results in an extra command
line token passed to the original browser process.
Bug found by willchan.
Review URL: http://codereview.chromium.org/113714
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16629 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/process_singleton_linux.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc index 667b1d6..94a64c6 100644 --- a/chrome/browser/process_singleton_linux.cc +++ b/chrome/browser/process_singleton_linux.cc @@ -204,8 +204,8 @@ void ProcessSingleton::LinuxWatcher::SocketReader::OnFileCanReadWithoutBlocking( return; } - // Validate the message. The shortest message is kStartToken\0x\0x\0 - const ssize_t kMinMessageLength = strlen(kStartToken) + 5; + // Validate the message. The shortest message is kStartToken\0x\0x + const ssize_t kMinMessageLength = strlen(kStartToken) + 4; if (rv < kMinMessageLength) { LOG(ERROR) << "Invalid socket message (wrong length):" << buf; return; @@ -264,7 +264,7 @@ bool ProcessSingleton::NotifyOtherProcess() { setsockopt(socket, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)); // Found another process, prepare our command line - // format is "START\0<current dir>\0<argv[0]>\0...\0<argv[n]>\0". + // format is "START\0<current dir>\0<argv[0]>\0...\0<argv[n]>". std::string to_send(kStartToken); to_send.push_back(kTokenDelimiter); @@ -272,14 +272,13 @@ bool ProcessSingleton::NotifyOtherProcess() { if (!PathService::Get(base::DIR_CURRENT, ¤t_dir)) return false; to_send.append(current_dir.value()); - to_send.push_back(kTokenDelimiter); const std::vector<std::string>& argv = CommandLine::ForCurrentProcess()->argv(); for (std::vector<std::string>::const_iterator it = argv.begin(); it != argv.end(); ++it) { - to_send.append(*it); to_send.push_back(kTokenDelimiter); + to_send.append(*it); } // Send the message |