mirror of
https://github.com/vim/vim.git
synced 2025-08-22 19:27:53 -04:00
patch 9.0.0164: using freed memory with put command
Problem: Using freed memory with put command. Solution: Get byte offset before replacing the line.
This commit is contained in:
parent
ecb00c7b61
commit
c390cc13e5
@ -2099,13 +2099,15 @@ do_put(
|
|||||||
ptr += yanklen;
|
ptr += yanklen;
|
||||||
}
|
}
|
||||||
STRMOVE(ptr, oldp + col);
|
STRMOVE(ptr, oldp + col);
|
||||||
ml_replace(lnum, newp, FALSE);
|
|
||||||
|
|
||||||
inserted_bytes(lnum, col, totlen);
|
|
||||||
|
|
||||||
// compute the byte offset for the last character
|
// compute the byte offset for the last character
|
||||||
first_byte_off = mb_head_off(newp, ptr - 1);
|
first_byte_off = mb_head_off(newp, ptr - 1);
|
||||||
|
|
||||||
|
// Note: this may free "newp"
|
||||||
|
ml_replace(lnum, newp, FALSE);
|
||||||
|
|
||||||
|
inserted_bytes(lnum, col, totlen);
|
||||||
|
|
||||||
// Place cursor on last putted char.
|
// Place cursor on last putted char.
|
||||||
if (lnum == curwin->w_cursor.lnum)
|
if (lnum == curwin->w_cursor.lnum)
|
||||||
{
|
{
|
||||||
|
@ -735,6 +735,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
164,
|
||||||
/**/
|
/**/
|
||||||
163,
|
163,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user