Skip to content
Permalink
Browse files Browse the repository at this point in the history
Check for result of recvfrom
PiperOrigin-RevId: 333399155
Change-Id: I3d79e1e3f45f75d4c4360d42499e511d84b9aff7
  • Loading branch information
kongoshuu committed Sep 23, 2020
1 parent 6c40785 commit 6e158d5
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 @@ -981,6 +981,11 @@ ssize_t enc_untrusted_recvfrom(int sockfd, void *buf, size_t len, int flags,
return result;
}

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

auto buffer_received = output.next();
memcpy(buf, buffer_received.data(), std::min(len, buffer_received.size()));

Expand Down

0 comments on commit 6e158d5

Please sign in to comment.