mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.4979: accessing freed memory when line is flushed
Problem: Accessing freed memory when line is flushed. Solution: Make a copy of the pattern to search for.
This commit is contained in:
@@ -579,9 +579,16 @@ wingotofile:
|
||||
CHECK_CMDWIN;
|
||||
if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0)
|
||||
break;
|
||||
|
||||
// Make a copy, if the line was changed it will be freed.
|
||||
ptr = vim_strnsave(ptr, len);
|
||||
if (ptr == NULL)
|
||||
break;
|
||||
|
||||
find_pattern_in_path(ptr, 0, len, TRUE,
|
||||
Prenum == 0 ? TRUE : FALSE, type,
|
||||
Prenum1, ACTION_SPLIT, (linenr_T)1, (linenr_T)MAXLNUM);
|
||||
vim_free(ptr);
|
||||
curwin->w_set_curswant = TRUE;
|
||||
break;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user