]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix buildinf.h generation for space and backslash
authorKai Pastor <dg0yt@darc.de>
Sat, 4 Jan 2025 10:48:26 +0000 (11:48 +0100)
committerRichard Levitte <levitte@openssl.org>
Fri, 10 Jan 2025 10:58:30 +0000 (11:58 +0100)
Builds may be configured with CC or CFLAGS containing space and
double quotes. In particular on Windows, this may lead to passing
more than two arguments into mkbuildinf.pl.
In addition, backslashes must be escaped for constructing the C string.

Fixes #26253.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26315)

(cherry picked from commit e87a3473fd1e9d901a89d4b14a53826723357701)

util/mkbuildinf.pl

index a57c80ab76cc7cee8244bf73ea87b70fa21cb6be..5cecf836b506365b5920484ea914449462f45187 100755 (executable)
@@ -9,7 +9,9 @@
 use strict;
 use warnings;
 
-my ($cflags, $platform) = @ARGV;
+my $platform = pop @ARGV;
+my $cflags = join(' ', @ARGV);
+$cflags =~ s(\\)(\\\\)g;
 $cflags = "compiler: $cflags";
 
 # Use the value of the envvar SOURCE_DATE_EPOCH, even if it's