Blame SOURCES/7.4.505

d6ba96
To: vim_dev@googlegroups.com
d6ba96
Subject: Patch 7.4.505
d6ba96
Fcc: outbox
d6ba96
From: Bram Moolenaar <Bram@moolenaar.net>
d6ba96
Mime-Version: 1.0
d6ba96
Content-Type: text/plain; charset=UTF-8
d6ba96
Content-Transfer-Encoding: 8bit
d6ba96
------------
d6ba96
d6ba96
Patch 7.4.505
d6ba96
Problem:    On MS-Windows when 'encoding' is a double-byte encoding a file
d6ba96
	    name longer than MAX_PATH bytes but shorter than that in
d6ba96
	    characters causes problems.
d6ba96
Solution:   Fail on file names longer than MAX_PATH bytes. (Ken Takata)
d6ba96
Files:	    src/os_win32.c
d6ba96
d6ba96
d6ba96
*** ../vim-7.4.504/src/os_win32.c	2014-10-16 16:16:33.970230873 +0200
d6ba96
--- src/os_win32.c	2014-11-05 18:32:54.624402126 +0100
d6ba96
***************
d6ba96
*** 6139,6144 ****
d6ba96
--- 6139,6151 ----
d6ba96
      }
d6ba96
  # endif
d6ba96
  
d6ba96
+     /* open() can open a file which name is longer than _MAX_PATH bytes
d6ba96
+      * and shorter than _MAX_PATH characters successfully, but sometimes it
d6ba96
+      * causes unexpected error in another part. We make it an error explicitly
d6ba96
+      * here. */
d6ba96
+     if (strlen(name) >= _MAX_PATH)
d6ba96
+ 	return -1;
d6ba96
+ 
d6ba96
      return open(name, flags, mode);
d6ba96
  }
d6ba96
  
d6ba96
***************
d6ba96
*** 6188,6193 ****
d6ba96
--- 6195,6207 ----
d6ba96
  	 * the _wfopen() fails for missing wide functions. */
d6ba96
      }
d6ba96
  
d6ba96
+     /* fopen() can open a file which name is longer than _MAX_PATH bytes
d6ba96
+      * and shorter than _MAX_PATH characters successfully, but sometimes it
d6ba96
+      * causes unexpected error in another part. We make it an error explicitly
d6ba96
+      * here. */
d6ba96
+     if (strlen(name) >= _MAX_PATH)
d6ba96
+ 	return NULL;
d6ba96
+ 
d6ba96
      return fopen(name, mode);
d6ba96
  }
d6ba96
  #endif
d6ba96
*** ../vim-7.4.504/src/version.c	2014-11-05 18:18:13.156423366 +0100
d6ba96
--- src/version.c	2014-11-05 18:33:06.684401835 +0100
d6ba96
***************
d6ba96
*** 743,744 ****
d6ba96
--- 743,746 ----
d6ba96
  {   /* Add new patch number below this line */
d6ba96
+ /**/
d6ba96
+     505,
d6ba96
  /**/
d6ba96
d6ba96
-- 
d6ba96
5 out of 4 people have trouble with fractions.
d6ba96
d6ba96
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
d6ba96
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
d6ba96
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
d6ba96
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///