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