0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.0034: missing check for out of memory

Problem:    Missing check for out of memory.
Solution:   Check for NULL after vim_strsave(). (Dominique Pelle,
            closes #5393)
This commit is contained in:
Bram Moolenaar
2019-12-23 18:18:52 +01:00
parent 7c77b34967
commit 70188f5b23
2 changed files with 7 additions and 1 deletions

View File

@@ -1658,7 +1658,8 @@ f_resolve(typval_T *argvars, typval_T *rettv)
int limit = 100; int limit = 100;
p = vim_strsave(p); p = vim_strsave(p);
if (p == NULL)
goto fail;
if (p[0] == '.' && (vim_ispathsep(p[1]) if (p[0] == '.' && (vim_ispathsep(p[1])
|| (p[1] == '.' && (vim_ispathsep(p[2]))))) || (p[1] == '.' && (vim_ispathsep(p[2])))))
is_relative_to_current = TRUE; is_relative_to_current = TRUE;
@@ -1681,7 +1682,10 @@ f_resolve(typval_T *argvars, typval_T *rettv)
buf = alloc(MAXPATHL + 1); buf = alloc(MAXPATHL + 1);
if (buf == NULL) if (buf == NULL)
{
vim_free(p);
goto fail; goto fail;
}
for (;;) for (;;)
{ {

View File

@@ -742,6 +742,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 */
/**/
34,
/**/ /**/
33, 33,
/**/ /**/