summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2022-10-05 10:37:38 -0400
committerChet Ramey <chet.ramey@case.edu>2022-10-05 10:37:38 -0400
commita99d905216cc0aac5de0c3050f4afc54e21c6bc5 (patch)
tree09bdd8c235b10731041cbb999d01964c29be7b55
parenta1e58b8c064cbf3cb0180b63e581770de7ccea5b (diff)
downloadbash-a99d905216cc0aac5de0c3050f4afc54e21c6bc5.tar.gz
Bash-5.2 patch 2: fix crash in readline when started with an invalid locale specification
-rw-r--r--lib/readline/nls.c4
-rw-r--r--patchlevel.h2
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/readline/nls.c b/lib/readline/nls.c
index 5c6a13b6..8c027d6b 100644
--- a/lib/readline/nls.c
+++ b/lib/readline/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.h b/patchlevel.h
index c0dbb500..d465c244 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 1
+#define PATCHLEVEL 2
#endif /* _PATCHLEVEL_H_ */