Fix buildinf.h generation for space and backslash

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 e87a3473fd)
This commit is contained in:
Kai Pastor 2025-01-04 11:48:26 +01:00 committed by Richard Levitte
parent 2f1fd7cb97
commit ba0fdad773
1 changed files with 3 additions and 1 deletions

View File

@ -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