[Buildroot] [git commit branch/2023.02.x] package/readline: add upstream patch to fix crash with invalid locale specification

Peter Korsgaard peter at korsgaard.com
Tue May 2 06:47:33 UTC 2023


commit: https://git.buildroot.net/buildroot/commit/?id=e5e171093f195227012e76821933d5052ae04e2c
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2023.02.x

Add upstream patch to fix crash with invalid locale specification (see [1]
for details).

Fixes:

  - https://bugs.busybox.net/show_bug.cgi?id=15456

[1] https://lists.gnu.org/archive/html/bug-readline/2022-10/msg00002.html

Signed-off-by: Peter Seiderer <ps.report at gmx.net>
Tested-by: Stefan Agner <stefan at agner.ch>
Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
(cherry picked from commit 2dff6e93ca2a675cebe5cfb6d864ff5da78a4ef4)
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
---
 ...2-patch-1-fix-crash-when-readline-is-star.patch | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/package/readline/0002-Readline-8.2-patch-1-fix-crash-when-readline-is-star.patch b/package/readline/0002-Readline-8.2-patch-1-fix-crash-when-readline-is-star.patch
new file mode 100644
index 0000000000..b0f784b8ba
--- /dev/null
+++ b/package/readline/0002-Readline-8.2-patch-1-fix-crash-when-readline-is-star.patch
@@ -0,0 +1,41 @@
+From b8d91eab12603fa88e095248855f5f772d182d05 Mon Sep 17 00:00:00 2001
+From: Chet Ramey <chet.ramey at case.edu>
+Date: Wed, 5 Oct 2022 10:41:16 -0400
+Subject: [PATCH] Readline-8.2 patch 1: fix crash when readline is started with
+ an invalid locale specification
+
+[Upstream: https://git.savannah.gnu.org/cgit/readline.git/patch/?id=7274faabe97ce53d6b464272d7e6ab6c1392837b
+ Stripped unrelated ._.gitignore change]
+Signed-off-by: Peter Seiderer <ps.report at gmx.net>
+---
+ nls.c      | 4 ++++
+ patchlevel | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/nls.c b/nls.c
+index 5c6a13b..8c027d6 100644
+--- a/nls.c
++++ b/nls.c
+@@ -141,6 +141,10 @@ _rl_init_locale (void)
+   if (lspec == 0)
+     lspec = "";
+   ret = setlocale (LC_CTYPE, lspec);	/* ok, since it does not change locale */
++  if (ret == 0 || *ret == 0)
++    ret = setlocale (LC_CTYPE, (char *)NULL);
++  if (ret == 0 || *ret == 0)
++    ret = RL_DEFAULT_LOCALE;
+ #else
+   ret = (lspec == 0 || *lspec == 0) ? RL_DEFAULT_LOCALE : lspec;
+ #endif
+diff --git a/patchlevel b/patchlevel
+index d8c9df7..fdf4740 100644
+--- a/patchlevel
++++ b/patchlevel
+@@ -1,3 +1,3 @@
+ # Do not edit -- exists only for use by patch
+ 
+-0
++1
+-- 
+2.39.2
+



More information about the buildroot mailing list