From d8870b1f64ae927e9469082490760b760ef5616f Mon Sep 17 00:00:00 2001 From: Nicolas Roche Date: Tue, 11 May 2021 07:58:42 +0200 Subject: [PATCH] [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. --- gcc/ada/rtinit.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/ada/rtinit.c b/gcc/ada/rtinit.c index 391c7e9406f3..83a63c8eb459 100644 --- a/gcc/ada/rtinit.c +++ b/gcc/ada/rtinit.c @@ -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