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