]>
Commit | Line | Data |
---|---|---|
17e7d110 SS |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.051 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.051 | |
11 | Problem: Crash when $PATH is empty. | |
12 | Solution: Check for vim_getenv() returning NULL. (Yasuhiro Matsumoto) | |
13 | Files: src/ex_getln.c, src/os_win32.c | |
14 | ||
15 | ||
16 | *** ../vim-7.3.050/src/ex_getln.c 2010-10-27 12:58:19.000000000 +0200 | |
17 | --- src/ex_getln.c 2010-11-10 15:31:33.000000000 +0100 | |
18 | *************** | |
19 | *** 4747,4753 **** | |
20 | --- 4747,4757 ---- | |
21 | || (pat[1] == '.' && vim_ispathsep(pat[2]))))) | |
22 | path = (char_u *)"."; | |
23 | else | |
24 | + { | |
25 | path = vim_getenv((char_u *)"PATH", &mustfree); | |
26 | + if (path == NULL) | |
27 | + path = (char_u *)""; | |
28 | + } | |
29 | ||
30 | /* | |
31 | * Go over all directories in $PATH. Expand matches in that directory and | |
32 | *** ../vim-7.3.050/src/os_win32.c 2010-10-27 12:17:54.000000000 +0200 | |
33 | --- src/os_win32.c 2010-11-10 15:30:36.000000000 +0100 | |
34 | *************** | |
35 | *** 211,223 **** | |
36 | static void | |
37 | get_exe_name(void) | |
38 | { | |
39 | ! char temp[MAXPATHL]; | |
40 | char_u *p; | |
41 | ||
42 | if (exe_name == NULL) | |
43 | { | |
44 | /* store the name of the executable, may be used for $VIM */ | |
45 | ! GetModuleFileName(NULL, temp, MAXPATHL - 1); | |
46 | if (*temp != NUL) | |
47 | exe_name = FullName_save((char_u *)temp, FALSE); | |
48 | } | |
49 | --- 211,226 ---- | |
50 | static void | |
51 | get_exe_name(void) | |
52 | { | |
53 | ! /* Maximum length of $PATH is more than MAXPATHL. 8191 is often mentioned | |
54 | ! * as the maximum length that works (plus a NUL byte). */ | |
55 | ! #define MAX_ENV_PATH_LEN 8192 | |
56 | ! char temp[MAX_ENV_PATH_LEN]; | |
57 | char_u *p; | |
58 | ||
59 | if (exe_name == NULL) | |
60 | { | |
61 | /* store the name of the executable, may be used for $VIM */ | |
62 | ! GetModuleFileName(NULL, temp, MAX_ENV_PATH_LEN - 1); | |
63 | if (*temp != NUL) | |
64 | exe_name = FullName_save((char_u *)temp, FALSE); | |
65 | } | |
66 | *************** | |
67 | *** 232,241 **** | |
68 | * "!xxd" it's found in our starting directory. Needed because | |
69 | * SearchPath() also looks there. */ | |
70 | p = mch_getenv("PATH"); | |
71 | ! if (STRLEN(p) + STRLEN(exe_path) + 2 < MAXPATHL) | |
72 | { | |
73 | ! STRCPY(temp, p); | |
74 | ! STRCAT(temp, ";"); | |
75 | STRCAT(temp, exe_path); | |
76 | vim_setenv((char_u *)"PATH", temp); | |
77 | } | |
78 | --- 235,250 ---- | |
79 | * "!xxd" it's found in our starting directory. Needed because | |
80 | * SearchPath() also looks there. */ | |
81 | p = mch_getenv("PATH"); | |
82 | ! if (p == NULL | |
83 | ! || STRLEN(p) + STRLEN(exe_path) + 2 < MAX_ENV_PATH_LEN) | |
84 | { | |
85 | ! if (p == NULL || *p == NUL) | |
86 | ! temp[0] = NUL; | |
87 | ! else | |
88 | ! { | |
89 | ! STRCPY(temp, p); | |
90 | ! STRCAT(temp, ";"); | |
91 | ! } | |
92 | STRCAT(temp, exe_path); | |
93 | vim_setenv((char_u *)"PATH", temp); | |
94 | } | |
95 | *** ../vim-7.3.050/src/version.c 2010-11-03 22:32:18.000000000 +0100 | |
96 | --- src/version.c 2010-11-10 15:34:43.000000000 +0100 | |
97 | *************** | |
98 | *** 716,717 **** | |
99 | --- 716,719 ---- | |
100 | { /* Add new patch number below this line */ | |
101 | + /**/ | |
102 | + 51, | |
103 | /**/ | |
104 | ||
105 | -- | |
106 | SIGFUN -- signature too funny (core dumped) | |
107 | ||
108 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
109 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
110 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
111 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |