Commit 68f6d3ae61 for openssl.org
commit 68f6d3ae6109742d4939da49f5b7383da462491f
Author: Neil Horman <nhorman@openssl.org>
Date: Sun Sep 13 17:40:54 2026 -0400
Make system exec directly rather than calling /bin/sh
When perl uses system() to call an external binary, if the argument is a
single array, perl uses /bin/sh and passes the entire argument as the
command line (i.e. /bin/sh -c @ARGV)
This is normally fine, but on platforms in which /bin/sh is an older
shell, @ARGV can easily overflow the command line space (e.g. on
nonstop).
Instead, shift off the first argument, then call system(argv[0], @ARGV).
This forces perl to call exec directly, rather than using the shell,
avoiding that.
Fixes #32778
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Merge-date: Thu Sep 17 16:46:28 2026
Merged-from: https://github.com/openssl/openssl/pull/32816
diff --git a/util/file-from-stdout.pl b/util/file-from-stdout.pl
index 8a8180e229..8c4946e568 100644
--- a/util/file-from-stdout.pl
+++ b/util/file-from-stdout.pl
@@ -42,12 +42,13 @@ END {
unlink $temp if defined $temp && -e $temp;
}
+my $exec = shift @ARGV;
open my $saved, ">&", \*STDOUT
or die "Can't save stdout, $!\n";
open STDOUT, ">&", $out
or die "Can't redirect stdout to $temp, $!\n";
-my $status = system @ARGV;
+my $status = system($exec, @ARGV);
my $why = $!;
open STDOUT, ">&", $saved
@@ -62,7 +63,7 @@ if ($status != 0) {
: "exited with " . ($status >> 8);
my $code = $status == -1 || ($status & 127) ? 1 : $status >> 8;
- print STDERR "$ARGV[0] $how\n";
+ print STDERR "$exec $how\n";
exit $code;
}