Projects
openEuler:24.03:SP1:Everything
bash
_service:tar_scm:backport-fix-for-leak-when-com...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-fix-for-leak-when-completing-command-word-with-glob-.patch of Package bash
From 7f7ee0e9c6766ff5d3de542d03c59590c4a5a44a Mon Sep 17 00:00:00 2001 From: Chet Ramey <chet.ramey@case.edu> Date: Mon, 17 Jul 2023 17:35:59 -0400 Subject: [PATCH] fix for leak when completing command word with glob pattern that matches multiple files; preserve export attribute when unsetting local variable in case it is reset; fix for using nl_langinfo when performing charset conversions --- bashline.c | 6 +++++- lib/sh/unicode.c | 6 +++++- variables.c | 6 ++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/bashline.c b/bashline.c index c85b05b..2e0c0c7 100644 --- a/bashline.c +++ b/bashline.c @@ -2203,7 +2203,11 @@ globword: local_index = 0; if (glob_matches[1] && rl_completion_type == TAB) /* multiple matches are bad */ - return ((char *)NULL); + { + strvec_dispose (glob_matches); + glob_matches = (char **)NULL; + return ((char *)NULL); + } } while (val = glob_matches[local_index++]) diff --git a/lib/sh/unicode.c b/lib/sh/unicode.c index d781353..9e3c9da 100644 --- a/lib/sh/unicode.c +++ b/lib/sh/unicode.c @@ -35,6 +35,10 @@ # include <iconv.h> #endif +#if HAVE_LANGINFO_CODESET +# include <langinfo.h> +#endif + #include <xmalloc.h> #ifndef USHORT_MAX @@ -277,7 +281,7 @@ u32cconv (c, s) { #if HAVE_LOCALE_CHARSET charset = locale_charset (); -#elif HAVE_NL_LANGINFO +#elif HAVE_LANGINFO_CODESET charset = nl_langinfo (CODESET); #else charset = stub_charset (); diff --git a/variables.c b/variables.c index 1a0c2c4..f08575a 100644 --- a/variables.c +++ b/variables.c @@ -4016,10 +4016,16 @@ makunbound (name, vc) FREE (nameref_cell (old_var)); else FREE (value_cell (old_var)); +#if 0 /* Reset the attributes. Preserve the export attribute if the variable came from a temporary environment. Make sure it stays local, and make it invisible. */ old_var->attributes = (exported_p (old_var) && tempvar_p (old_var)) ? att_exported : 0; +#else /* TAG:bash-5.3 look at this again */ + /* Reset the attributes, but preserve the export attribute. + Make sure it stays local, and make it invisible. */ + old_var->attributes = exported_p (old_var) ? att_exported : 0; +#endif VSETATTR (old_var, att_local); VSETATTR (old_var, att_invisible); var_setvalue (old_var, (char *)NULL); -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2