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

Unified Diff: chrome/common/ipc_channel_posix.cc

Issue 20275: POSIX: Clean up DescriptorSet (Closed)
Patch Set: ... Created 11 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/descriptor_set_posix.cc ('k') | chrome/common/ipc_message.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/ipc_channel_posix.cc
diff --git a/chrome/common/ipc_channel_posix.cc b/chrome/common/ipc_channel_posix.cc
index b46024caf3754e823fe95d87de744bc13f49e8c4..72d15549285e51ef6e43c903b7dd8e5087875dbb 100644
--- a/chrome/common/ipc_channel_posix.cc
+++ b/chrome/common/ipc_channel_posix.cc
@@ -483,13 +483,24 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
const char* message_tail = Message::FindNext(p, end);
if (message_tail) {
int len = static_cast<int>(message_tail - p);
- const Message m(p, len);
+ Message m(p, len);
if (m.header()->num_fds) {
// the message has file descriptors
+ const char* error = NULL;
if (m.header()->num_fds > num_fds - fds_i) {
// the message has been completely received, but we didn't get
// enough file descriptors.
- LOG(WARNING) << "Message needs unreceived descriptors"
+ error = "Message needs unreceived descriptors";
+ }
+
+ if (m.header()->num_fds >
+ DescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE) {
+ // There are too many descriptors in this message
+ error = "Message requires an excessive number of descriptors";
+ }
+
+ if (error) {
+ LOG(WARNING) << error
<< " channel:" << this
<< " message-type:" << m.type()
<< " header()->num_fds:" << m.header()->num_fds
@@ -499,6 +510,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
for (unsigned i = fds_i; i < num_fds; ++i)
close(fds[i]);
input_overflow_fds_.clear();
+ // abort the connection
return false;
}
« no previous file with comments | « chrome/common/descriptor_set_posix.cc ('k') | chrome/common/ipc_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698