Skip to content
Permalink
Browse files Browse the repository at this point in the history
Check return result in recvmsg
PiperOrigin-RevId: 333411798
Change-Id: I61986b5a1bffd79c0e1950013aa9de09cf4a5d61
  • Loading branch information
kongoshuu committed Sep 24, 2020
1 parent 6e158d5 commit fa6485c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions asylo/platform/host_call/trusted/host_calls.cc
Expand Up @@ -822,6 +822,11 @@ ssize_t enc_untrusted_recvmsg(int sockfd, struct msghdr *msg, int flags) {
return result;
}

if (result > total_buffer_size) {
::asylo::primitives::TrustedPrimitives::BestEffortAbort(
"enc_untrusted_recvmsg: result exceeds requested");
}

auto msg_name_extent = output.next();
// The returned |msg_namelen| should not exceed the buffer size.
if (msg_name_extent.size() <= msg->msg_namelen) {
Expand Down

0 comments on commit fa6485c

Please sign in to comment.