Patch 8.2.2793
Problem:    MS-Windows: string literals are writable with MSVC.
Solution:   Add the /GF compiler flag.  Make mch_write() safer. (Ken Takata,
            closes #8133)
Files:      src/Make_mvc.mak, src/os_win32.c


*** ../vim-8.2.2792/src/Make_mvc.mak    2021-02-20 20:13:38.429336057 +0100
--- src/Make_mvc.mak    2021-04-21 11:29:06.266753256 +0200
***************
*** 489,495 ****
  #VIMRCLOC = somewhere
  #VIMRUNTIMEDIR = somewhere
  
! CFLAGS = -c /W3 /nologo $(CVARS) -I. -Iproto -DHAVE_PATHDEF -DWIN32 \
                $(CSCOPE_DEFS) $(TERM_DEFS) $(SOUND_DEFS) $(NETBEANS_DEFS) 
$(CHANNEL_DEFS) \
                $(NBDEBUG_DEFS) $(XPM_DEFS) \
                $(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
--- 489,495 ----
  #VIMRCLOC = somewhere
  #VIMRUNTIMEDIR = somewhere
  
! CFLAGS = -c /W3 /GF /nologo $(CVARS) -I. -Iproto -DHAVE_PATHDEF -DWIN32 \
                $(CSCOPE_DEFS) $(TERM_DEFS) $(SOUND_DEFS) $(NETBEANS_DEFS) 
$(CHANNEL_DEFS) \
                $(NBDEBUG_DEFS) $(XPM_DEFS) \
                $(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
*** ../vim-8.2.2792/src/os_win32.c      2021-04-20 10:33:24.629417153 +0200
--- src/os_win32.c      2021-04-21 11:29:06.266753256 +0200
***************
*** 6406,6420 ****
      char_u  *s,
      int           len)
  {
  # ifdef VIMDLL
      if (gui.in_use)
        return;
  # endif
  
-     // Avoid writing to a string literal.
-     if (s[len] != NUL)
-       s[len] = NUL;
- 
      if (!term_console)
      {
        write(1, s, (unsigned)len);
--- 6406,6418 ----
      char_u  *s,
      int           len)
  {
+     char_u  *end = s + len;
+ 
  # ifdef VIMDLL
      if (gui.in_use)
        return;
  # endif
  
      if (!term_console)
      {
        write(1, s, (unsigned)len);
***************
*** 6435,6444 ****
            return;
        }
  
!       while ((ch = s[++prefix]))
            if (ch <= 0x1e && !(ch != '\n' && ch != '\r' && ch != '\b'
                                                && ch != '\a' && ch != '\033'))
                break;
  
        if (p_wd)
        {
--- 6433,6445 ----
            return;
        }
  
!       while (s + ++prefix < end)
!       {
!           ch = s[prefix];
            if (ch <= 0x1e && !(ch != '\n' && ch != '\r' && ch != '\b'
                                                && ch != '\a' && ch != '\033'))
                break;
+       }
  
        if (p_wd)
        {
*** ../vim-8.2.2792/src/version.c       2021-04-20 22:16:35.355248931 +0200
--- src/version.c       2021-04-21 11:30:01.346731302 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2793,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
132. You come back and check this list every half-hour.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/202104210931.13L9VHeP1058210%40masaka.moolenaar.net.

Raspunde prin e-mail lui