From 84639382136f823c2433ab211b6e5c086dde3503 Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Tue, 27 Feb 2024 21:09:15 +0100 Subject: [PATCH] Do not escape $@ twice in validator run script generator. This is not needed because it is within single quotes. --- judge/judgedaemon.main.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/judge/judgedaemon.main.php b/judge/judgedaemon.main.php index f38b201373..c0dab33e6a 100644 --- a/judge/judgedaemon.main.php +++ b/judge/judgedaemon.main.php @@ -418,13 +418,15 @@ function fetch_executable_internal( // no main class detection here $buildscript .= "echo 'COMPARE_DIR=\$(dirname \"\$0\")' >> run\n"; $mainClass = basename($unescapedSource, '.java'); - $buildscript .= "echo 'java -cp \"\$COMPARE_DIR\" $mainClass \"\\\$@\"' >> run\n"; + // Note: since the $@ is within single quotes, we do not need to double escape it. + $buildscript .= "echo 'java -cp \"\$COMPARE_DIR\" $mainClass \"\$@\"' >> run\n"; $buildscript .= "chmod +x run\n"; break; case 'py': $buildscript .= "echo '#!/bin/sh' > run\n"; $buildscript .= "echo 'COMPARE_DIR=\$(dirname \"\$0\")' >> run\n"; - $buildscript .= "echo 'python3 \$COMPARE_DIR/$source' \"\\\$@\" >> run\n"; + // Note: since the $@ is within single quotes, we do not need to double escape it. + $buildscript .= "echo 'python3 \"\$COMPARE_DIR/$source\" \"\$@\"' >> run\n"; $buildscript .= "chmod +x run\n"; break; }