Apply upstream patch to fix here-doc handling

This commit is contained in:
Andrej Shadura 2025-01-03 11:49:20 +01:00
parent f48383dffe
commit 4450adbc8b
No known key found for this signature in database
GPG Key ID: 2526E9EB828A8F35
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,27 @@
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Fri, 24 May 2024 22:41:00 +0800
Subject: parser: Fix here-doc EOF marker bug with negative chars
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 a552c47..81a3cdb 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1122,7 +1122,7 @@ more_heredoc:
len = out - p;
if (len) {
- len -= c < 0;
+ len -= c <= PEOF;
c = p[-1];
if (len) {

View File

@ -11,4 +11,5 @@
0020-Update-manpages.patch
0021-jobs-Implement-pipefail-option.patch
0022-builtin-Align-test-nt-and-ot-with-POSIX.1-2024.patch
0023-parser-Fix-here-doc-EOF-marker-bug-with-negative-cha.patch
9001-Add-privmode.diff