Skip to content

Commit e87cdb5

Browse files
committed
Replace snprintf usage in enclave with oe_snprintf
This is part of the work on #151. We're removing direct libc dependencies from src/enclave.
1 parent 750e130 commit e87cdb5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/enclave/sgxlkl_app_config.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <errno.h>
22
#include <json-c/json_object.h>
3-
#include <stdio.h>
43
#include <string.h>
54

65
#include "enclave/enclave_util.h"
@@ -10,6 +9,7 @@
109
#include "shared/json_util.h"
1110

1211
#include "openenclave/corelibc/oemalloc.h"
12+
#include "openenclave/corelibc/oestdio.h"
1313
#include "openenclave/corelibc/oestring.h"
1414

1515
static const char* STRING_KEYS[] = {"run",
@@ -99,7 +99,7 @@ static int parse_env(sgxlkl_app_config_t* config, struct json_object* env_val)
9999
if (!env_kv)
100100
sgxlkl_fail(
101101
"Failed to allocate memory for environment key value pair.\n");
102-
snprintf(env_kv, kv_len, "%s=%s", key, str_val);
102+
oe_snprintf(env_kv, kv_len, "%s=%s", key, str_val);
103103
config->envp[i++] = env_kv;
104104
}
105105

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef __OE_STDIO_INCLUDED__
2+
#define __OE_STDIO_INCLUDED__
3+
4+
int oe_snprintf(char* str, size_t size, const char* format, ...);
5+
6+
#endif

0 commit comments

Comments
 (0)