From 78b265e56098114ff6743276f57fc380595aa45b Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Thu, 28 May 2020 11:57:53 +0000 Subject: [PATCH] Remove libc dependencies from sgxlkl_config As part of the work on #151, we are removing libc dependencies from src/enclave. --- src/enclave/sgxlkl_config.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/enclave/sgxlkl_config.c b/src/enclave/sgxlkl_config.c index a4b575274..644bde95b 100644 --- a/src/enclave/sgxlkl_config.c +++ b/src/enclave/sgxlkl_config.c @@ -3,6 +3,8 @@ #include #include #include "openenclave/corelibc/oemalloc.h" +#include "openenclave/corelibc/oestring.h" +#include "openenclave/internal/safecrt.h" // Duplicate a string static int strdupz(char** to, const char* from) @@ -16,7 +18,7 @@ static int strdupz(char** to, const char* from) } else { - size_t l = strlen(from); + size_t l = oe_strlen(from); *to = oe_malloc(l + 1); if (!*to) { @@ -100,7 +102,7 @@ int sgxlkl_copy_config(const sgxlkl_config_t* from, sgxlkl_config_t** to) cfg->net_gw4 = from->net_gw4; cfg->net_mask4 = from->net_mask4; - strncpy(cfg->hostname, from->hostname, sizeof(cfg->hostname)); + oe_strncpy_s(cfg->hostname, sizeof(cfg->hostname),from->hostname, sizeof(cfg->hostname)); cfg->hostnet = from->hostnet; cfg->tap_offload = from->tap_offload; cfg->tap_mtu = from->tap_mtu;