0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

updated for version 7.4.505

Problem:    On MS-Windows when 'encoding' is a double-byte encoding a file
            name longer than MAX_PATH bytes but shorter than that in
            characters causes problems.
Solution:   Fail on file names longer than MAX_PATH bytes. (Ken Takata)
This commit is contained in:
Bram Moolenaar
2014-11-05 18:36:03 +01:00
parent 0434482e5a
commit f9e6c3b8b0
2 changed files with 16 additions and 0 deletions

View File

@@ -6139,6 +6139,13 @@ mch_open(char *name, int flags, int mode)
} }
# endif # endif
/* open() can open a file which name is longer than _MAX_PATH bytes
* and shorter than _MAX_PATH characters successfully, but sometimes it
* causes unexpected error in another part. We make it an error explicitly
* here. */
if (strlen(name) >= _MAX_PATH)
return -1;
return open(name, flags, mode); return open(name, flags, mode);
} }
@@ -6188,6 +6195,13 @@ mch_fopen(char *name, char *mode)
* the _wfopen() fails for missing wide functions. */ * the _wfopen() fails for missing wide functions. */
} }
/* fopen() can open a file which name is longer than _MAX_PATH bytes
* and shorter than _MAX_PATH characters successfully, but sometimes it
* causes unexpected error in another part. We make it an error explicitly
* here. */
if (strlen(name) >= _MAX_PATH)
return NULL;
return fopen(name, mode); return fopen(name, mode);
} }
#endif #endif

View File

@@ -741,6 +741,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
505,
/**/ /**/
504, 504,
/**/ /**/