To: vim_dev@googlegroups.com Subject: Patch 8.2.2136 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2136 Problem: Vim9: Using uninitialized variable. Solution: Initialize "len" to zero. Clean up fnamemodify(). Files: src/filepath.c *** ../vim-8.2.2135/src/filepath.c 2020-12-12 18:58:36.788284026 +0100 --- src/filepath.c 2020-12-13 12:24:09.588513006 +0100 *************** *** 1019,1025 **** char_u *fname; char_u *mods; int usedlen = 0; ! int len; char_u *fbuf = NULL; char_u buf[NUMBUFLEN]; --- 1019,1025 ---- char_u *fname; char_u *mods; int usedlen = 0; ! int len = 0; char_u *fbuf = NULL; char_u buf[NUMBUFLEN]; *************** *** 1028,1039 **** return; fname = tv_get_string_chk(&argvars[0]); mods = tv_get_string_buf_chk(&argvars[1], buf); ! if (fname == NULL) fname = NULL; ! else if (mods != NULL && *mods != NUL) { len = (int)STRLEN(fname); ! (void)modify_fname(mods, FALSE, &usedlen, &fname, &fbuf, &len); } rettv->v_type = VAR_STRING; --- 1028,1040 ---- return; fname = tv_get_string_chk(&argvars[0]); mods = tv_get_string_buf_chk(&argvars[1], buf); ! if (mods == NULL || fname == NULL) fname = NULL; ! else { len = (int)STRLEN(fname); ! if (mods != NULL && *mods != NUL) ! (void)modify_fname(mods, FALSE, &usedlen, &fname, &fbuf, &len); } rettv->v_type = VAR_STRING; *** ../vim-8.2.2135/src/version.c 2020-12-12 21:25:52.837244962 +0100 --- src/version.c 2020-12-13 12:25:07.140345213 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2136, /**/ -- Did Adam and Eve have navels? /// 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 ///