about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-05-07 16:26:16 +0200
committerptitSeb <sebastien.chev@gmail.com>2025-05-07 16:26:25 +0200
commitec549690944d2768b811340bc999abdfbc60ca2c (patch)
treea02218507635737c22a75ebd9dff053f44eb949d /src
parent11513d662daf7a584b307eb3e27a512edef711b5 (diff)
downloadbox64-ec549690944d2768b811340bc999abdfbc60ca2c.tar.gz
box64-ec549690944d2768b811340bc999abdfbc60ca2c.zip
[WRAPPER] Better handling of secure_getenv, but still not perfect
Diffstat (limited to 'src')
-rw-r--r--src/wrapped/wrappedlibc.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index 3761f609..4815f57d 100644
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -2992,9 +2992,9 @@ EXPORT void* my_realpath(x64emu_t* emu, void* path, void* resolved_path)
 
 EXPORT int my_readlinkat(x64emu_t* emu, int fd, void* path, void* buf, size_t bufsize)
 {
-    if(isProcSelf(path, "exe")) {
-        strncpy(buf, emu->context->fullpath, bufsize);
-        size_t l = strlen(emu->context->fullpath);
+    if((fd==AT_FDCWD) && isProcSelf(path, "exe")) {
+        strncpy(buf, my_context->fullpath, bufsize);
+        size_t l = strlen(my_context->fullpath);
         return (l>bufsize)?bufsize:(l+1);
     }
     return readlinkat(fd, path, buf, bufsize);
@@ -3871,6 +3871,13 @@ EXPORT char* my_program_invocation_short_name = NULL;
 // ignoring this for now
 EXPORT char my___libc_single_threaded = 0;
 
+EXPORT char* secure_getenv(const char* name)
+{
+    // ignoring the "secure" part for now
+    //TODO: better handling of user and process ID
+    return getenv(name);
+}
+
 #ifdef STATICBUILD
 uint32_t get_random32();
 __attribute__((weak)) uint32_t arc4random()