summaryrefslogtreecommitdiff
path: root/source/ap/vim/patches/7.3.051
blob: ebf3680b0f6324eccb176da6cedade77b219642f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
To: vim_dev@googlegroups.com
Subject: Patch 7.3.051
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.051
Problem:    Crash when $PATH is empty.
Solution:   Check for vim_getenv() returning NULL. (Yasuhiro Matsumoto)
Files:	    src/ex_getln.c, src/os_win32.c


*** ../vim-7.3.050/src/ex_getln.c	2010-10-27 12:58:19.000000000 +0200
--- src/ex_getln.c	2010-11-10 15:31:33.000000000 +0100
***************
*** 4747,4753 ****
--- 4747,4757 ----
  			    || (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
*** ../vim-7.3.050/src/os_win32.c	2010-10-27 12:17:54.000000000 +0200
--- src/os_win32.c	2010-11-10 15:30:36.000000000 +0100
***************
*** 211,223 ****
      static void
  get_exe_name(void)
  {
!     char	temp[MAXPATHL];
      char_u	*p;
  
      if (exe_name == NULL)
      {
  	/* store the name of the executable, may be used for $VIM */
! 	GetModuleFileName(NULL, temp, MAXPATHL - 1);
  	if (*temp != NUL)
  	    exe_name = FullName_save((char_u *)temp, FALSE);
      }
--- 211,226 ----
      static void
  get_exe_name(void)
  {
!     /* 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, MAX_ENV_PATH_LEN - 1);
  	if (*temp != NUL)
  	    exe_name = FullName_save((char_u *)temp, FALSE);
      }
***************
*** 232,241 ****
  	     * "!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)
  	    {
! 		STRCPY(temp, p);
! 		STRCAT(temp, ";");
  		STRCAT(temp, exe_path);
  		vim_setenv((char_u *)"PATH", temp);
  	    }
--- 235,250 ----
  	     * "!xxd" it's found in our starting directory.  Needed because
  	     * SearchPath() also looks there. */
  	    p = mch_getenv("PATH");
! 	    if (p == NULL
! 		       || STRLEN(p) + STRLEN(exe_path) + 2 < MAX_ENV_PATH_LEN)
  	    {
! 		if (p == NULL || *p == NUL)
! 		    temp[0] = NUL;
! 		else
! 		{
! 		    STRCPY(temp, p);
! 		    STRCAT(temp, ";");
! 		}
  		STRCAT(temp, exe_path);
  		vim_setenv((char_u *)"PATH", temp);
  	    }
*** ../vim-7.3.050/src/version.c	2010-11-03 22:32:18.000000000 +0100
--- src/version.c	2010-11-10 15:34:43.000000000 +0100
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     51,
  /**/

-- 
SIGFUN -- signature too funny (core dumped)

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///