mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-04 15:51:15 -03:00
Fix a buffer overflow in cached_esc_sequences_t::find_entry
cached_esc_sequences_t::find_entry was constructing a wcstring from a c string, using lengths longer than the length of the cstring. Detected with asan.
This commit is contained in:
@@ -242,7 +242,9 @@ class cached_esc_sequences_t {
|
||||
}
|
||||
|
||||
size_t find_entry(const wchar_t *entry) {
|
||||
size_t entry_len = wcslen(entry);
|
||||
for (auto len : lengths) {
|
||||
if (len > entry_len) continue;
|
||||
auto match = cache.find(wcstring(entry, len));
|
||||
if (match != cache.end()) { // we found a matching cached sequence
|
||||
// Periodically sort the sequence lengths so we check for matches going from the
|
||||
|
||||
Reference in New Issue
Block a user