summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-11-05 18:36:03 +0100
committerBram Moolenaar <Bram@vim.org>2014-11-05 18:36:03 +0100
commitf9e6c3b8b00ea562e0b9ddf96f85c365cdf41627 (patch)
tree2149696788fcd448d5d64cb7b51f33e787bed55d
parent0434482e5aa5a46b7da27f745c22ec36d35f2c7e (diff)
downloadvim-git-f9e6c3b8b00ea562e0b9ddf96f85c365cdf41627.tar.gz
updated for version 7.4.505v7.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)
-rw-r--r--src/os_win32.c14
-rw-r--r--src/version.c2
2 files changed, 16 insertions, 0 deletions
diff --git a/src/os_win32.c b/src/os_win32.c
index c03b963c4..fcfafa01e 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -6139,6 +6139,13 @@ mch_open(char *name, int flags, int mode)
}
# 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);
}
@@ -6188,6 +6195,13 @@ mch_fopen(char *name, char *mode)
* 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);
}
#endif
diff --git a/src/version.c b/src/version.c
index 4bbc22155..178a7845f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 505,
+/**/
504,
/**/
503,