From 2bb3cbefdb8fd019765b1a9cc42ecf37ff22fec6 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Thu, 9 Nov 2023 16:48:34 -0500 Subject: [PATCH] Bash-5.2 patch 21: fix for expanding command substitutions in a word expansion in a here-document --- patchlevel.h | 2 +- subst.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/patchlevel.h b/patchlevel.h index 2db9d9cea..1712b108f 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -25,6 +25,6 @@ regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh looks for to find the patch level (for the sccs version string). */ -#define PATCHLEVEL 20 +#define PATCHLEVEL 21 #endif /* _PATCHLEVEL_H_ */ diff --git a/subst.c b/subst.c index 1ac6eb2d9..0dfabfea9 100644 --- a/subst.c +++ b/subst.c @@ -1693,7 +1693,7 @@ extract_heredoc_dolbrace_string (string, sindex, quoted, flags) t = extract_command_subst (string, &si, flags); CHECK_STRING_OVERRUN (i, si, slen, c); - tlen = si - i - 1; + tlen = si - i - 2; RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 4, result_size, 64); result[result_index++] = c; result[result_index++] = LPAREN; @@ -1713,7 +1713,7 @@ extract_heredoc_dolbrace_string (string, sindex, quoted, flags) t = extract_process_subst (string, (string[i] == '<' ? "<(" : ">)"), &si, flags); CHECK_STRING_OVERRUN (i, si, slen, c); - tlen = si - i - 1; + tlen = si - i - 2; RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 4, result_size, 64); result[result_index++] = c; result[result_index++] = LPAREN; -- 2.47.3