Skip to content

Commit 78b265e

Browse files
committed
Remove libc dependencies from sgxlkl_config
As part of the work on #151, we are removing libc dependencies from src/enclave.
1 parent e842e1b commit 78b265e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/enclave/sgxlkl_config.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include <enclave/enclave_util.h>
44
#include <shared/sgxlkl_config.h>
55
#include "openenclave/corelibc/oemalloc.h"
6+
#include "openenclave/corelibc/oestring.h"
7+
#include "openenclave/internal/safecrt.h"
68

79
// Duplicate a string
810
static int strdupz(char** to, const char* from)
@@ -16,7 +18,7 @@ static int strdupz(char** to, const char* from)
1618
}
1719
else
1820
{
19-
size_t l = strlen(from);
21+
size_t l = oe_strlen(from);
2022
*to = oe_malloc(l + 1);
2123
if (!*to)
2224
{
@@ -100,7 +102,7 @@ int sgxlkl_copy_config(const sgxlkl_config_t* from, sgxlkl_config_t** to)
100102
cfg->net_gw4 = from->net_gw4;
101103
cfg->net_mask4 = from->net_mask4;
102104

103-
strncpy(cfg->hostname, from->hostname, sizeof(cfg->hostname));
105+
oe_strncpy_s(cfg->hostname, sizeof(cfg->hostname),from->hostname, sizeof(cfg->hostname));
104106
cfg->hostnet = from->hostnet;
105107
cfg->tap_offload = from->tap_offload;
106108
cfg->tap_mtu = from->tap_mtu;

0 commit comments

Comments
 (0)