mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 9.0.0047: using freed memory with recursive substitute
Problem: Using freed memory with recursive substitute. Solution: Always make a copy for reg_prev_sub.
This commit is contained in:
@@ -3994,7 +3994,16 @@ ex_substitute(exarg_T *eap)
|
||||
sub_copy = sub;
|
||||
}
|
||||
else
|
||||
sub = regtilde(sub, magic_isset());
|
||||
{
|
||||
char_u *newsub = regtilde(sub, magic_isset());
|
||||
|
||||
if (newsub != sub)
|
||||
{
|
||||
// newsub was allocated, free it later.
|
||||
sub_copy = newsub;
|
||||
sub = newsub;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for a match on each line.
|
||||
|
Reference in New Issue
Block a user