changeset 17795:9c15c85db5d8 v8.1.1894

patch 8.1.1894: not checking for out-of-memory of autoload_name() commit https://github.com/vim/vim/commit/1058c9d9b5815467182d487f10f6dd71385cb796 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 20 21:58:00 2019 +0200 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 https://github.com/vim/vim/issues/4846)
author Bram Moolenaar <Bram@vim.org>
date Tue, 20 Aug 2019 22:00:03 +0200
parents b12378999d97
children 9ebba5c49827
files src/eval.c src/version.c
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -9439,7 +9439,7 @@ autoload_name(char_u *name)
     // Get the script file name: replace '#' with '/', append ".vim".
     scriptname = alloc(STRLEN(name) + 14);
     if (scriptname == NULL)
-	return FALSE;
+	return NULL;
     STRCPY(scriptname, "autoload/");
     STRCAT(scriptname, name);
     for (p = scriptname + 9; (p = vim_strchr(p, AUTOLOAD_CHAR)) != NULL;
@@ -9469,6 +9469,8 @@ script_autoload(
 	return FALSE;
 
     tofree = scriptname = autoload_name(name);
+    if (scriptname == NULL)
+	return FALSE;
 
     /* Find the name in the list of previously loaded package names.  Skip
      * "autoload/", it's always the same. */
--- a/src/version.c
+++ b/src/version.c
@@ -766,6 +766,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1894,
+/**/
     1893,
 /**/
     1892,