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 -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202012131126.0BDBQ01I3031947%40masaka.moolenaar.net.