mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.0378
Problem: Another possible overflow when reading corrupted undo file.
Solution: Check if allocated size is not too big. (King)
0c8485f0e4
CVE-2017-6350
This commit is contained in:
parent
fb66a7c69e
commit
ad66826abe
@ -967,12 +967,12 @@ static u_entry_T *unserialize_uep(bufinfo_T * bi, bool *error,
|
||||
uep->ue_lcount = undo_read_4c(bi);
|
||||
uep->ue_size = undo_read_4c(bi);
|
||||
|
||||
char_u **array;
|
||||
char_u **array = NULL;
|
||||
if (uep->ue_size > 0) {
|
||||
if ((size_t)uep->ue_size < SIZE_MAX / sizeof(char_u *)) {
|
||||
array = xmalloc(sizeof(char_u *) * (size_t)uep->ue_size);
|
||||
memset(array, 0, sizeof(char_u *) * (size_t)uep->ue_size);
|
||||
} else {
|
||||
array = NULL;
|
||||
}
|
||||
}
|
||||
uep->ue_array = array;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user