[Ada] Handle malformed command line on Win32

gcc/ada/

	* rtinit.c (skip_quoted_string): Handle malformed command line
	with no closing double quote.
	(skip_argument): Handle case in which a null character is
	encountered by skip_quote_string.
This commit is contained in:
Nicolas Roche 2021-05-11 07:58:42 +02:00 committed by Pierre-Marie de Rodat
parent 435e79cbe5
commit d8870b1f64

View File

@ -147,6 +147,19 @@ static void skip_quoted_string (const WCHAR **current_in,
}
ci++;
}
/* Handle the case in which a nul character was found instead of a closing
double quote. In that case consider all the backslashes as literal
characters. */
if (*ci == '\0')
{
for (int i=0; i<qbs_count; i++)
{
*co='\\';
co++;
}
}
*current_in = ci;
*current_out = co;
}
@ -205,7 +218,10 @@ static void skip_argument (const WCHAR **current_in,
bs_count = 0;
*co = *ci; co++;
}
ci++;
if (*ci != '\0')
{
ci++;
}
}
for (int i=0; i<bs_count; i++)