mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.1.0739: [security]: use-after-free in ex_getln.c (#30448)
Problem: [security]: use-after-free in ex_getln.c
Solution: free pointer p a bit later (John Marriott)
closes: vim/vim#15712
a6de28755e
Co-authored-by: John Marriott <basilisk@internode.on.net>
This commit is contained in:
parent
059a9e6254
commit
d8cd15e8d6
@ -3028,7 +3028,6 @@ void realloc_cmdbuff(int len)
|
|||||||
// there, thus copy up to the NUL and add a NUL.
|
// there, thus copy up to the NUL and add a NUL.
|
||||||
memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen);
|
memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen);
|
||||||
ccline.cmdbuff[ccline.cmdlen] = NUL;
|
ccline.cmdbuff[ccline.cmdlen] = NUL;
|
||||||
xfree(p);
|
|
||||||
|
|
||||||
if (ccline.xpc != NULL
|
if (ccline.xpc != NULL
|
||||||
&& ccline.xpc->xp_pattern != NULL
|
&& ccline.xpc->xp_pattern != NULL
|
||||||
@ -3042,6 +3041,8 @@ void realloc_cmdbuff(int len)
|
|||||||
ccline.xpc->xp_pattern = ccline.cmdbuff + i;
|
ccline.xpc->xp_pattern = ccline.cmdbuff + i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xfree(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum { MAX_CB_ERRORS = 1, };
|
enum { MAX_CB_ERRORS = 1, };
|
||||||
|
Loading…
Reference in New Issue
Block a user