public inbox for dash@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] parser: Fix here-doc EOF marker bug with negative chars
@ 2024-05-24 14:41 Herbert Xu
  0 siblings, 0 replies; only message in thread
From: Herbert Xu @ 2024-05-24 14:41 UTC (permalink / raw)
  To: DASH Mailing List

The here-document EOF marker parsing code incorrectly treats all
negative bytes as EOF instead of just PEOF.  Fix this by testing
against PEOF.

Fixes: 81daadfce8d5 ("[PARSER] Removed noexpand/length check on eofmark")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
 src/parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/parser.c b/src/parser.c
index 27611f0..09b1cb8 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1127,7 +1127,7 @@ more_heredoc:
 			len = out - p;
 
 			if (len) {
-				len -= c < 0;
+				len -= c <= PEOF;
 				c = p[-1];
 
 				if (len) {
-- 
2.39.2

-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-24 14:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-24 14:41 [PATCH] parser: Fix here-doc EOF marker bug with negative chars Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox