OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ipc/ipc_channel_posix.h" | 5 #include "ipc/ipc_channel_posix.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 | 793 |
794 ssize_t bytes_written = 1; | 794 ssize_t bytes_written = 1; |
795 int fd_written = -1; | 795 int fd_written = -1; |
796 | 796 |
797 if (message_send_bytes_written_ == 0 && | 797 if (message_send_bytes_written_ == 0 && |
798 !msg->file_descriptor_set()->empty()) { | 798 !msg->file_descriptor_set()->empty()) { |
799 // This is the first chunk of a message which has descriptors to send | 799 // This is the first chunk of a message which has descriptors to send |
800 struct cmsghdr *cmsg; | 800 struct cmsghdr *cmsg; |
801 const unsigned num_fds = msg->file_descriptor_set()->size(); | 801 const unsigned num_fds = msg->file_descriptor_set()->size(); |
802 | 802 |
803 DCHECK_LE(num_fds, FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE); | 803 DCHECK_LE(num_fds, static_cast<unsigned>( |
| 804 FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE)); |
804 if (msg->file_descriptor_set()->ContainsDirectoryDescriptor()) { | 805 if (msg->file_descriptor_set()->ContainsDirectoryDescriptor()) { |
805 LOG(FATAL) << "Panic: attempting to transport directory descriptor over" | 806 LOG(FATAL) << "Panic: attempting to transport directory descriptor over" |
806 " IPC. Aborting to maintain sandbox isolation."; | 807 " IPC. Aborting to maintain sandbox isolation."; |
807 // If you have hit this then something tried to send a file descriptor | 808 // If you have hit this then something tried to send a file descriptor |
808 // to a directory over an IPC channel. Since IPC channels span | 809 // to a directory over an IPC channel. Since IPC channels span |
809 // sandboxes this is very bad: the receiving process can use openat | 810 // sandboxes this is very bad: the receiving process can use openat |
810 // with ".." elements in the path in order to reach the real | 811 // with ".." elements in the path in order to reach the real |
811 // filesystem. | 812 // filesystem. |
812 } | 813 } |
813 | 814 |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 channel_impl_->OverridePeerPid(peer_pid); | 1248 channel_impl_->OverridePeerPid(peer_pid); |
1248 } | 1249 } |
1249 #endif // defined(OS_LINUX) | 1250 #endif // defined(OS_LINUX) |
1250 | 1251 |
1251 // static | 1252 // static |
1252 bool Channel::IsNamedServerInitialized(const std::string& channel_id) { | 1253 bool Channel::IsNamedServerInitialized(const std::string& channel_id) { |
1253 return ChannelImpl::IsNamedServerInitialized(channel_id); | 1254 return ChannelImpl::IsNamedServerInitialized(channel_id); |
1254 } | 1255 } |
1255 | 1256 |
1256 } // namespace IPC | 1257 } // namespace IPC |
OLD | NEW |