Skip to content
Permalink
Browse files Browse the repository at this point in the history
Check return pointer is outside enclave in realloc
PiperOrigin-RevId: 333769459
Change-Id: If53b5f4317080b8abaf5c4f80ce751f150630bcb
  • Loading branch information
kongoshuu committed Sep 25, 2020
1 parent fa6485c commit ed0926b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions asylo/platform/host_call/trusted/host_calls.cc
Expand Up @@ -644,6 +644,12 @@ void *enc_untrusted_realloc(void *ptr, size_t size) {
if (!result && size != 0) {
errno = FromkLinuxErrorNumber(klinux_errno);
}

if (!::asylo::primitives::TrustedPrimitives::IsOutsideEnclave(result, size)) {
::asylo::primitives::TrustedPrimitives::BestEffortAbort(
"enc_untrusted_realloc: realloc result should be in untrusted "
"memory");
}
return result;
}

Expand Down

0 comments on commit ed0926b

Please sign in to comment.