parser: Do not read past single quote in dollarsq_escape

The function dollarsq_escape may read past the current escape
code in order to provide enough data to the underlying escape
code processing function.  This is OK because we will call unget
to return any unused characters.  However, if this occurs at
the end of a quoted string, this may prompt the user for more
input which is wrong.

Fix this by terminating the loop whenever we see a single quote.
Even if this is an escaped single quote and thus does not indicate
the end of the whole quoted string, it's still OK because no single
escape code can continue after a single quote.

Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Fixes: 776424a8f915 ("parser: Add dollar single quote")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 file changed