diff mbox series

parser: Fix here-doc EOF marker bug with negative chars

Message ID ZlCm_BeRZ3POGHSR@gondor.apana.org.au (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series parser: Fix here-doc EOF marker bug with negative chars | expand

Commit Message

Herbert Xu May 24, 2024, 2:41 p.m. UTC
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 mbox series

Patch

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) {