Index: ipc/ipc_channel_win.cc |
diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc |
index 10af1fecdb34a4317c3a4588f9788ba6dbff4f17..afed565339260253e4790e76a2e9e703711ad8ae 100644 |
--- a/ipc/ipc_channel_win.cc |
+++ b/ipc/ipc_channel_win.cc |
@@ -10,6 +10,7 @@ |
#include "base/bind.h" |
#include "base/compiler_specific.h" |
#include "base/logging.h" |
+#include "base/pickle.h" |
#include "base/process_util.h" |
#include "base/rand_util.h" |
#include "base/string_number_conversions.h" |
@@ -153,17 +154,24 @@ bool Channel::ChannelImpl::WillDispatchInputMessage(Message* msg) { |
void Channel::ChannelImpl::HandleHelloMessage(const Message& msg) { |
// The hello message contains one parameter containing the PID. |
- MessageIterator it = MessageIterator(msg); |
- int32 claimed_pid = it.NextInt(); |
- if (validate_client_ && (it.NextInt() != client_secret_)) { |
+ PickleIterator it(msg); |
+ int32 claimed_pid; |
+ bool failed = !it.ReadInt(&claimed_pid); |
+ |
+ if (!failed && validate_client_) { |
+ int32 secret; |
+ failed = it.ReadInt(&secret) ? (secret != client_secret_) : true; |
+ } |
+ |
+ if (failed) { |
NOTREACHED(); |
- // Something went wrong. Abort connection. |
Close(); |
listener()->OnChannelError(); |
return; |
} |
+ |
peer_pid_ = claimed_pid; |
- // validation completed. |
+ // Validation completed. |
validate_client_ = false; |
listener()->OnChannelConnected(claimed_pid); |
} |