mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-12-04 15:46:07 +00:00
* fix(appimage): verify bundled apt packages and keep the CWD off XDG dirs The AppImage recipes fetched the Ubuntu packages they bundle (libc6, GTK, GStreamer, ...) over HTTP with allow_unauthenticated, and the aarch64 key came from the keyserver over HTTP. Use the HTTPS archive, drop allow_unauthenticated, and trust Ubuntu's 2012 and 2018 archive signing keys, both of which sign focal, from a key file in the repository. XDG_DATA_DIRS and XDG_CONFIG_DIRS end with the host value, which AppRun expands to nothing when the host leaves it unset; the empty element makes GLib search the current directory, so launching the AppImage from a directory someone else can write let it supply gtk-3.0/settings.ini and similar files. Put a "/" before the host value: unset it leaves the root, set its first absolute path becomes the same "//path". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JAxkkig1bcC5Xrr1uwX47b * fix(appimage): keep the CWD off LD_LIBRARY_PATH when the host has none AppRun sets LD_LIBRARY_PATH to "$APPDIR_LIBRARY_PATH:" followed by the host's value, so a host without LD_LIBRARY_PATH (the usual case) gets an empty last element, which the dynamic loader searches as the current directory. RustDesk looked up libpulsecommon and libGLX there, and the loginctl it runs looked up libsystemd-shared there on every call, so a library planted in the directory the AppImage is started from would be loaded. Patch AppRun to drop empty elements after building the value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JAxkkig1bcC5Xrr1uwX47b --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1.7 KiB
Diff
42 lines
1.7 KiB
Diff
diff --git a/src/apprun/runtime_interpreter.c b/src/apprun/runtime_interpreter.c
|
|
index fe06502..33ddd8e 100644
|
|
--- a/src/apprun/runtime_interpreter.c
|
|
+++ b/src/apprun/runtime_interpreter.c
|
|
@@ -143,6 +143,20 @@ long compare_version_strings(const char *a, const char *b) {
|
|
return 0;
|
|
}
|
|
|
|
+/* An empty element, as appending an unset LD_LIBRARY_PATH leaves, makes the dynamic loader search
|
|
+ * the current directory. */
|
|
+static void apprun_drop_empty_path_elements(char *path) {
|
|
+ char *out = path;
|
|
+ for (const char *in = path; *in != '\0'; in++) {
|
|
+ if (*in == ':' && (out == path || out[-1] == ':'))
|
|
+ continue;
|
|
+ *out++ = *in;
|
|
+ }
|
|
+ if (out > path && out[-1] == ':')
|
|
+ out--;
|
|
+ *out = '\0';
|
|
+}
|
|
+
|
|
void configure_embed_libc() {
|
|
#ifdef DEBUG
|
|
fprintf(stderr, "APPRUN_DEBUG: using appdir libc\n");
|
|
@@ -150,6 +164,7 @@ void configure_embed_libc() {
|
|
char *ld_library_path = apprun_shell_expand_variables("$"APPDIR_LIBRARY_PATH_ENV":"
|
|
"$"APPDIR_LIBC_LIBRARY_PATH_ENV":"
|
|
"$"APPRUN_ENV_ORIG_PREFIX"LD_LIBRARY_PATH", NULL);
|
|
+ apprun_drop_empty_path_elements(ld_library_path);
|
|
|
|
apprun_env_set("LD_LIBRARY_PATH", ld_library_path, "", ld_library_path);
|
|
free(ld_library_path);
|
|
@@ -161,6 +176,7 @@ void configure_system_libc() {
|
|
#endif
|
|
char *ld_library_path = apprun_shell_expand_variables("$"APPDIR_LIBRARY_PATH_ENV":"
|
|
"$"APPRUN_ENV_ORIG_PREFIX"LD_LIBRARY_PATH", NULL);
|
|
+ apprun_drop_empty_path_elements(ld_library_path);
|
|
|
|
apprun_env_set("LD_LIBRARY_PATH", ld_library_path, "", ld_library_path);
|
|
free(ld_library_path);
|