0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.1.1894: not checking for out-of-memory of autoload_name()

Problem:    Not checking for out-of-memory of autoload_name().
Solution:   Check for NULL. (Dominique Pelle, closes #4846)
This commit is contained in:
Bram Moolenaar
2019-08-20 21:58:00 +02:00
parent f1e0544d41
commit 1058c9d9b5
2 changed files with 5 additions and 1 deletions

View File

@@ -9439,7 +9439,7 @@ autoload_name(char_u *name)
// Get the script file name: replace '#' with '/', append ".vim". // Get the script file name: replace '#' with '/', append ".vim".
scriptname = alloc(STRLEN(name) + 14); scriptname = alloc(STRLEN(name) + 14);
if (scriptname == NULL) if (scriptname == NULL)
return FALSE; return NULL;
STRCPY(scriptname, "autoload/"); STRCPY(scriptname, "autoload/");
STRCAT(scriptname, name); STRCAT(scriptname, name);
for (p = scriptname + 9; (p = vim_strchr(p, AUTOLOAD_CHAR)) != NULL; for (p = scriptname + 9; (p = vim_strchr(p, AUTOLOAD_CHAR)) != NULL;
@@ -9469,6 +9469,8 @@ script_autoload(
return FALSE; return FALSE;
tofree = scriptname = autoload_name(name); tofree = scriptname = autoload_name(name);
if (scriptname == NULL)
return FALSE;
/* Find the name in the list of previously loaded package names. Skip /* Find the name in the list of previously loaded package names. Skip
* "autoload/", it's always the same. */ * "autoload/", it's always the same. */

View File

@@ -765,6 +765,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 */
/**/
1894,
/**/ /**/
1893, 1893,
/**/ /**/