Fix an off by one error while calling mbrtowc()

Resolves: #2115206
This commit is contained in:
Siteshwar Vashisht 2022-08-08 13:51:50 +02:00
parent aee0886289
commit bfa3f2c35f
2 changed files with 20 additions and 1 deletions

12
bash-5.1-mbrtowc.patch Normal file
View File

@ -0,0 +1,12 @@
diff --git a/subst.c b/subst.c
--- a/subst.c
+++ b/subst.c
@@ -6240,7 +6240,7 @@ read_comsub (fd, quoted, flags, rflag)
/* read a multibyte character from buf */
/* punt on the hard case for now */
memset (&ps, '\0', sizeof (mbstate_t));
- mblen = mbrtowc (&wc, bufp-1, bufn+1, &ps);
+ mblen = mbrtowc (&wc, bufp-1, bufn, &ps);
if (MB_INVALIDCH (mblen) || mblen == 0 || mblen == 1)
istring[istring_index++] = c;
else

View File

@ -6,7 +6,7 @@
Version: %{baseversion}%{patchleveltag} Version: %{baseversion}%{patchleveltag}
Name: bash Name: bash
Summary: The GNU Bourne Again shell Summary: The GNU Bourne Again shell
Release: 4%{?dist} Release: 5%{?dist}
License: GPLv3+ License: GPLv3+
Url: https://www.gnu.org/software/bash Url: https://www.gnu.org/software/bash
Source0: https://ftp.gnu.org/gnu/bash/bash-%{baseversion}.tar.gz Source0: https://ftp.gnu.org/gnu/bash/bash-%{baseversion}.tar.gz
@ -87,6 +87,9 @@ Patch127: bash-4.4-no-loadable-builtins.patch
# This option is undocumented in upstream and is documented by this patch # This option is undocumented in upstream and is documented by this patch
Patch128: bash-5.0-syslog-history.patch Patch128: bash-5.0-syslog-history.patch
# 2115206 - String matching behaves differently on aarch64
Patch129: bash-5.1-mbrtowc.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: texinfo bison BuildRequires: texinfo bison
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
@ -318,6 +321,10 @@ end
%{_libdir}/pkgconfig/%{name}.pc %{_libdir}/pkgconfig/%{name}.pc
%changelog %changelog
* Mon Aug 08 2022 Siteshwar Vashisht <svashisht@redhat.com> - 5.1.8-5
- Fix an off by one error while calling mbrtowc()
Resolves: #2115206
* Fri Nov 05 2021 Siteshwar Vashisht <svashisht@redhat.com> - 5.1.8-4 * Fri Nov 05 2021 Siteshwar Vashisht <svashisht@redhat.com> - 5.1.8-4
- Fix runtime option to enable history logging to syslog - Fix runtime option to enable history logging to syslog
Resolves: #2020519 Resolves: #2020519