summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0587
blob: 51e712b5c815443802ee77fe5a6397ef7ce9fab6 (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0587
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0587
Problem:    GvimExt: realloc() failing is not handled properly.
Solution:   Check for NULL return. (Jan-Jaap Korpershoek, closes #3689)
Files:	    src/GvimExt/gvimext.cpp


*** ../vim-8.1.0586/src/GvimExt/gvimext.cpp	2018-10-25 11:25:50.166512213 +0200
--- src/GvimExt/gvimext.cpp	2018-12-14 19:15:54.292680774 +0100
***************
*** 1024,1029 ****
--- 1024,1031 ----
  
      cmdlen = BUFSIZE;
      cmdStrW  = (wchar_t *) malloc(cmdlen * sizeof(wchar_t));
+     if (cmdStrW == NULL)
+ 	return;
      getGvimInvocationW(cmdStrW);
  
      if (useDiff)
***************
*** 1039,1045 ****
  	if (len > cmdlen)
  	{
  	    cmdlen = len + BUFSIZE;
! 	    cmdStrW = (wchar_t *)realloc(cmdStrW, cmdlen * sizeof(wchar_t));
  	}
  	wcscat(cmdStrW, L" \"");
  	wcscat(cmdStrW, m_szFileUserClickedOn);
--- 1041,1050 ----
  	if (len > cmdlen)
  	{
  	    cmdlen = len + BUFSIZE;
! 	    wchar_t *cmdStrW_new = (wchar_t *)realloc(cmdStrW, cmdlen * sizeof(wchar_t));
! 	    if (cmdStrW_new == NULL)
! 		goto theend;
! 	    cmdStrW = cmdStrW_new;
  	}
  	wcscat(cmdStrW, L" \"");
  	wcscat(cmdStrW, m_szFileUserClickedOn);
***************
*** 1076,1082 ****
  	CloseHandle(pi.hProcess);
  	CloseHandle(pi.hThread);
      }
! 
      free(cmdStrW);
  
      return NOERROR;
--- 1081,1087 ----
  	CloseHandle(pi.hProcess);
  	CloseHandle(pi.hThread);
      }
! theend:
      free(cmdStrW);
  
      return NOERROR;
*** ../vim-8.1.0586/src/version.c	2018-12-14 18:52:57.169528762 +0100
--- src/version.c	2018-12-14 19:17:18.488135136 +0100
***************
*** 801,802 ****
--- 801,804 ----
  {   /* Add new patch number below this line */
+ /**/
+     587,
  /**/

-- 
A)bort, R)etry, B)ang it with a large hammer

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///