Skip to content
Permalink
Browse files Browse the repository at this point in the history
Check for result size in dst in inet_ntop
PiperOrigin-RevId: 333814318
Change-Id: Id7766ed598809f5df42d457f224d6f3dea06c224
  • Loading branch information
kongoshuu committed Sep 25, 2020
1 parent bda9772 commit 6ff3b77
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions asylo/platform/host_call/trusted/host_calls.cc
Expand Up @@ -1325,9 +1325,10 @@ const char *enc_untrusted_inet_ntop(int af, const void *src, char *dst,
return nullptr;
}

memcpy(dst, result.data(),
std::min(static_cast<size_t>(size),
static_cast<size_t>(INET6_ADDRSTRLEN)));
memcpy(
dst, result.data(),
std::min({static_cast<size_t>(size), static_cast<size_t>(result.size()),
static_cast<size_t>(INET6_ADDRSTRLEN)}));
return dst;
}

Expand Down

0 comments on commit 6ff3b77

Please sign in to comment.