mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-15 09:27:38 +00:00
Fix invalid memory access regression
Commit f872f25f
introduced a freed memory access regression on line 460
of env.cpp, where an environment variable was converted to a temporary
string, the .c_str() address of which was stored while the string
temporary was destroyed.
This commit keeps a reference to the original string lying around so
that the c_str() pointer does not point to freed memory.
This commit is contained in:
parent
e656654456
commit
dfeac760b9
1 changed files with 2 additions and 1 deletions
|
@ -457,7 +457,8 @@ static bool does_term_support_setting_title() {
|
|||
const env_var_t term_var = env_get(L"TERM");
|
||||
if (term_var.missing_or_empty()) return false;
|
||||
|
||||
const wchar_t *term = term_var.as_string().c_str();
|
||||
const wcstring term_str = term_var.as_string();
|
||||
const wchar_t *term = term_str.c_str();
|
||||
bool recognized = contains(title_terms, term_var.as_string());
|
||||
if (!recognized) recognized = !wcsncmp(term, L"xterm-", wcslen(L"xterm-"));
|
||||
if (!recognized) recognized = !wcsncmp(term, L"screen-", wcslen(L"screen-"));
|
||||
|
|
Loading…
Reference in a new issue