Merge pull request #10 from pamarcos/fix_insufficient_buffer

Fix insufficient buffer for LD_LIBRARY_PATH
This commit is contained in:
darealshinji 2018-01-08 20:18:11 +01:00 committed by GitHub
commit 5f97d55211
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -16,7 +16,7 @@
old_env = getenv("LD_LIBRARY_PATH") ?: "";
- SET_NEW_ENV(new_ld_library_path, appdir_s*10 + strlen(old_env), "LD_LIBRARY_PATH=%s/usr/lib/:%s/usr/lib/i386-linux-gnu/:%s/usr/lib/x86_64-linux-gnu/:%s/usr/lib32/:%s/usr/lib64/:%s/lib/:%s/lib/i386-linux-gnu/:%s/lib/x86_64-linux-gnu/:%s/lib32/:%s/lib64/:%s", appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, old_env);
+ SET_NEW_ENV(new_ld_library_path, appdir_s*10 + strlen(old_env), "LD_LIBRARY_PATH=%s%s/usr/lib/:%s/usr/lib/i386-linux-gnu/:%s/usr/lib/x86_64-linux-gnu/:%s/usr/lib32/:%s/usr/lib64/:%s/lib/:%s/lib/i386-linux-gnu/:%s/lib/x86_64-linux-gnu/:%s/lib32/:%s/lib64/:%s", optional_ld_library_path, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, old_env);
+ SET_NEW_ENV(new_ld_library_path, strlen(optional_ld_library_path) + appdir_s*10 + strlen(old_env), "LD_LIBRARY_PATH=%s%s/usr/lib/:%s/usr/lib/i386-linux-gnu/:%s/usr/lib/x86_64-linux-gnu/:%s/usr/lib32/:%s/usr/lib64/:%s/lib/:%s/lib/i386-linux-gnu/:%s/lib/x86_64-linux-gnu/:%s/lib32/:%s/lib64/:%s", optional_ld_library_path, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, old_env);
old_env = getenv("PYTHONPATH") ?: "";
SET_NEW_ENV(new_pythonpath, appdir_s + strlen(old_env), "PYTHONPATH=%s/usr/share/pyshared/:%s", appdir, old_env);

8
exec.c
View file

@ -283,7 +283,7 @@ int execve(const char* filename, char* const argv[], char* const envp[]) {
old_execve = dlsym(RTLD_NEXT, "execve");
int ret = old_execve(filename, argv, new_envp);
stringlist_free(new_envp);
DEBUG(">>> custom execve()!\n");
DEBUG("custom execve()!\n");
return ret;
}
@ -292,7 +292,7 @@ int execv(const char* filename, char* const argv[]) {
old_execve = dlsym(RTLD_NEXT, "execve");
int ret = old_execve(filename, argv, new_envp);
stringlist_free(new_envp);
DEBUG(">>> custom execv()!\n");
DEBUG("custom execv()!\n");
return ret;
}
@ -302,7 +302,7 @@ int execvpe(const char* filename, char* const argv[], char* const envp[]) {
old_execvpe = dlsym(RTLD_NEXT, "execvpe");
int ret = old_execvpe(filename, argv, new_envp);
stringlist_free(new_envp);
DEBUG(">>> custom execvpe()!\n");
DEBUG("custom execvpe()!\n");
return ret;
}
@ -312,6 +312,6 @@ int execvp(const char* filename, char* const argv[]) {
old_execvpe = dlsym(RTLD_NEXT, "execvpe");
int ret = old_execvpe(filename, argv, new_envp);
stringlist_free(new_envp);
DEBUG(">>> custom execvp()!\n");
DEBUG("custom execvp()!\n");
return ret;
}