summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-11-10 15:37:05 +0100
committerBram Moolenaar <Bram@vim.org>2010-11-10 15:37:05 +0100
commit27d9eceb66e5b71594dc547c5243eebc3c15e5b8 (patch)
tree437f370c6cd5a7546bc59aa13507eca9c818a338
parent22e193ddd551cf67635e73231c259415bd70c135 (diff)
downloadvim-git-27d9eceb66e5b71594dc547c5243eebc3c15e5b8.tar.gz
updated for version 7.3.051v7.3.051
Problem: Crash when /home/mool/bin:/usr/local/sbin:/usr/local/bin:/home/mool/java/jdk/bin:/bin:/sbin:/usr/bin:/usr/games:/usr/sbin:/usr/X11R6/bin:/usr/local/linux-jdk1.3.1/bin:/usr/local/lib/python2.2/Tools/idle is empty. Solution: Check for vim_getenv() returning NULL. (Yasuhiro Matsumoto)
-rw-r--r--src/ex_getln.c4
-rw-r--r--src/os_win32.c19
-rw-r--r--src/version.c2
3 files changed, 20 insertions, 5 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index c3514874f..c0d2496b8 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4747,7 +4747,11 @@ expand_shellcmd(filepat, num_file, file, flagsarg)
|| (pat[1] == '.' && vim_ispathsep(pat[2])))))
path = (char_u *)".";
else
+ {
path = vim_getenv((char_u *)"PATH", &mustfree);
+ if (path == NULL)
+ path = (char_u *)"";
+ }
/*
* Go over all directories in $PATH. Expand matches in that directory and
diff --git a/src/os_win32.c b/src/os_win32.c
index 0ca47d0fe..423ea8903 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -211,13 +211,16 @@ static char_u *exe_path = NULL;
static void
get_exe_name(void)
{
- char temp[MAXPATHL];
+ /* Maximum length of $PATH is more than MAXPATHL. 8191 is often mentioned
+ * as the maximum length that works (plus a NUL byte). */
+#define MAX_ENV_PATH_LEN 8192
+ char temp[MAX_ENV_PATH_LEN];
char_u *p;
if (exe_name == NULL)
{
/* store the name of the executable, may be used for $VIM */
- GetModuleFileName(NULL, temp, MAXPATHL - 1);
+ GetModuleFileName(NULL, temp, MAX_ENV_PATH_LEN - 1);
if (*temp != NUL)
exe_name = FullName_save((char_u *)temp, FALSE);
}
@@ -232,10 +235,16 @@ get_exe_name(void)
* "!xxd" it's found in our starting directory. Needed because
* SearchPath() also looks there. */
p = mch_getenv("PATH");
- if (STRLEN(p) + STRLEN(exe_path) + 2 < MAXPATHL)
+ if (p == NULL
+ || STRLEN(p) + STRLEN(exe_path) + 2 < MAX_ENV_PATH_LEN)
{
- STRCPY(temp, p);
- STRCAT(temp, ";");
+ if (p == NULL || *p == NUL)
+ temp[0] = NUL;
+ else
+ {
+ STRCPY(temp, p);
+ STRCAT(temp, ";");
+ }
STRCAT(temp, exe_path);
vim_setenv((char_u *)"PATH", temp);
}
diff --git a/src/version.c b/src/version.c
index 8756e19bb..24992e771 100644
--- a/src/version.c
+++ b/src/version.c
@@ -715,6 +715,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 51,
+/**/
50,
/**/
49,