From 72b90665b6c9ec75ac95c16c69b45905b214e69c Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <104101892+pixeebot[bot]@users.noreply.github.com> Date: Thu, 11 Jul 2024 03:14:46 +0000 Subject: [PATCH] Introduced protections against system command injection --- core/src/mindustry/net/BeControl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/net/BeControl.java b/core/src/mindustry/net/BeControl.java index 668e687d7c8e..f89327524f1d 100644 --- a/core/src/mindustry/net/BeControl.java +++ b/core/src/mindustry/net/BeControl.java @@ -5,6 +5,7 @@ import arc.func.*; import arc.util.*; import arc.util.serialization.*; +import io.github.pixee.security.SystemCommand; import mindustry.*; import mindustry.core.*; import mindustry.gen.*; @@ -107,10 +108,9 @@ public void showUpdateDialog(){ BaseDialog dialog = new BaseDialog("@be.updating"); download(updateUrl, file, i -> length[0] = i, v -> progress[0] = v, () -> cancel[0], () -> { try{ - Runtime.getRuntime().exec(OS.isMac ? + SystemCommand.runCommand(Runtime.getRuntime(), OS.isMac ? new String[]{javaPath, "-XstartOnFirstThread", "-DlastBuild=" + Version.build, "-Dberestart", "-Dbecopy=" + fileDest.absolutePath(), "-jar", file.absolutePath()} : - new String[]{javaPath, "-DlastBuild=" + Version.build, "-Dberestart", "-Dbecopy=" + fileDest.absolutePath(), "-jar", file.absolutePath()} - ); + new String[]{javaPath, "-DlastBuild=" + Version.build, "-Dberestart", "-Dbecopy=" + fileDest.absolutePath(), "-jar", file.absolutePath()}); System.exit(0); }catch(IOException e){ ui.showException(e);