From 1c7a270e26e538af75844653e02361569b5b82d8 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 19 Mar 2026 01:56:46 +0100 Subject: [PATCH] sshserver.pl: harden more `system()` calls Ref: https://perldoc.perl.org/functions/system Closes #20997 --- tests/sshserver.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/sshserver.pl b/tests/sshserver.pl index 7d445548ac..8c0d00680b 100755 --- a/tests/sshserver.pl +++ b/tests/sshserver.pl @@ -424,14 +424,14 @@ if((! -e pp($hstprvkeyf)) || (! -s pp($hstprvkeyf)) || chmod 0600, pp($cliprvkeyf); if(($^O eq 'cygwin' || $^O eq 'msys') && -e "/bin/setfacl") { # https://cygwin.com/cygwin-ug-net/setfacl.html - system "/bin/setfacl --remove-all " . pp($hstprvkeyf); + system('/bin/setfacl', ('--remove-all', pp($hstprvkeyf))); } elsif(pathhelp::os_is_win()) { # https://ss64.com/nt/icacls.html $ENV{'MSYS2_ARG_CONV_EXCL'} = '/reset'; - system "icacls \"" . pathhelp::sys_native_abs_path(pp($hstprvkeyf)) . "\" /reset"; - system "icacls \"" . pathhelp::sys_native_abs_path(pp($hstprvkeyf)) . "\" /grant:r \"$username:(R)\""; - system "icacls \"" . pathhelp::sys_native_abs_path(pp($hstprvkeyf)) . "\" /inheritance:r"; + system('icacls', (pathhelp::sys_native_abs_path(pp($hstprvkeyf)), '/reset')); + system('icacls', (pathhelp::sys_native_abs_path(pp($hstprvkeyf)), '/grant:r', "$username:(R)")); + system('icacls', (pathhelp::sys_native_abs_path(pp($hstprvkeyf)), '/inheritance:r')); } # Save md5 and sha256 hashes of public host key open(my $rsakeyfile, "<", pp($hstpubkeyf));