To: vim_dev@googlegroups.com Subject: Patch 8.2.0099 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0099 Problem: Use of NULL pointer when out of memory. Solution: Check for NULL pointer. (Dominique Pelle, closes #5449) Files: src/cmdexpand.c *** ../vim-8.2.0098/src/cmdexpand.c 2020-01-05 22:05:46.448380159 +0100 --- src/cmdexpand.c 2020-01-07 21:04:40.183631093 +0100 *************** *** 2327,2333 **** char_u *path = NULL; int mustfree = FALSE; garray_T ga; ! char_u *buf = alloc(MAXPATHL); size_t l; char_u *s, *e; int flags = flagsarg; --- 2327,2333 ---- char_u *path = NULL; int mustfree = FALSE; garray_T ga; ! char_u *buf; size_t l; char_u *s, *e; int flags = flagsarg; *************** *** 2337,2348 **** hashitem_T *hi; hash_T hash; if (buf == NULL) return FAIL; ! // for ":set path=" and ":set tags=" halve backslashes for escaped ! // space pat = vim_strsave(filepat); for (i = 0; pat[i]; ++i) if (pat[i] == '\\' && pat[i + 1] == ' ') STRMOVE(pat + i, pat + i + 1); --- 2337,2354 ---- hashitem_T *hi; hash_T hash; + buf = alloc(MAXPATHL); if (buf == NULL) return FAIL; ! // for ":set path=" and ":set tags=" halve backslashes for escaped space pat = vim_strsave(filepat); + if (pat == NULL) + { + vim_free(buf); + return FAIL; + } + for (i = 0; pat[i]; ++i) if (pat[i] == '\\' && pat[i + 1] == ' ') STRMOVE(pat + i, pat + i + 1); *** ../vim-8.2.0098/src/version.c 2020-01-07 20:59:30.528926519 +0100 --- src/version.c 2020-01-07 21:05:31.467422596 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 99, /**/ -- How do you know when you have run out of invisible ink? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///