summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2024-09-15 21:16:57 +0000
committerMikael Magnusson <mikma@users.sourceforge.net>2024-09-15 21:16:57 +0000
commite1bd627d8e8e7366a8fa3e77777a44c5d6b7481d (patch)
tree081b07b847655b43f5202f271af7bf7c2601b8c9
parent958d3c5787b452ec8d60435390f1515a3ce0858b (diff)
parent8e74ad50c97ba0f7624a02189377753e24d52298 (diff)
Merge branches 'crypto-mbedtls' and 'fix-getenv' into build1build1
-rw-r--r--lib.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib.c b/lib.c
index e814f49..54ff354 100644
--- a/lib.c
+++ b/lib.c
@@ -854,21 +854,22 @@ uc_getenv(uc_vm_t *vm, size_t nargs)
{
uc_value_t *key = uc_fn_arg(0), *rv = NULL;
extern char **environ;
+ char **env = environ;
char *k, *v;
if (!key) {
rv = ucv_object_new(vm);
- while (*environ) {
- v = strchr(*environ, '=');
+ while (*env) {
+ v = strchr(*env, '=');
if (v) {
- xasprintf(&k, "%.*s", (int)(v - *environ), *environ);
+ xasprintf(&k, "%.*s", (int)(v - *env), *env);
ucv_object_add(rv, k, ucv_string_new(v + 1));
free(k);
}
- environ++;
+ env++;
}
}
else if (ucv_type(key) == UC_STRING) {