]> git.pld-linux.org Git - packages/vim.git/blob - 7.1.087
- typo
[packages/vim.git] / 7.1.087
1 To: vim-dev@vim.org
2 Subject: patch 7.1.087
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.1.087
11 Problem:    Reading past ":cscope find" command.  Writing past end of a buffer.
12 Solution:   Check length of the argument before using the pattern.  Use
13             vim_strncpy().  (Dominique Pelle)
14 Files:      if_cscope.c
15
16
17 *** ../vim-7.1.086/src/if_cscope.c      Sun Mar 11 15:48:29 2007
18 --- src/if_cscope.c     Sun Aug 19 22:17:09 2007
19 ***************
20 *** 73,78 ****
21 --- 73,80 ----
22   
23   
24   static csinfo_T           csinfo[CSCOPE_MAX_CONNECTIONS];
25 + static int        eap_arg_len;    /* length of eap->arg, set in
26 +                                      cs_lookup_cmd() */
27   static cscmd_T            cs_cmds[] =
28   {
29       { "add",  cs_add,
30 ***************
31 *** 260,273 ****
32   
33       if ((p = cs_manage_matches(NULL, NULL, -1, Get)) == NULL)
34         return TRUE;
35
36 !     if ((int)strlen(p) > size)
37 !     {
38 !       strncpy((char *)buf, p, size - 1);
39 !       buf[size] = '\0';
40 !     }
41 !     else
42 !       (void)strcpy((char *)buf, p);
43   
44       return FALSE;
45   } /* cs_fgets */
46 --- 262,268 ----
47   
48       if ((p = cs_manage_matches(NULL, NULL, -1, Get)) == NULL)
49         return TRUE;
50 !     vim_strncpy(buf, (char_u *)p, size - 1);
51   
52       return FALSE;
53   } /* cs_fgets */
54 ***************
55 *** 386,392 ****
56    * PRIVATE: cs_add
57    *
58    * add cscope database or a directory name (to look for cscope.out)
59 !  * the the cscope connection list
60    *
61    * MAXPATHL 256
62    */
63 --- 381,387 ----
64    * PRIVATE: cs_add
65    *
66    * add cscope database or a directory name (to look for cscope.out)
67 !  * to the cscope connection list
68    *
69    * MAXPATHL 256
70    */
71 ***************
72 *** 966,972 ****
73       }
74   
75       pat = opt + strlen(opt) + 1;
76 !     if (pat == NULL || (pat != NULL && pat[0] == '\0'))
77       {
78         cs_usage_msg(Find);
79         return FALSE;
80 --- 961,967 ----
81       }
82   
83       pat = opt + strlen(opt) + 1;
84 !     if (pat >= (char *)eap->arg + eap_arg_len)
85       {
86         cs_usage_msg(Find);
87         return FALSE;
88 ***************
89 *** 1317,1323 ****
90   #else
91             /* compare pathnames first */
92             && ((fullpathcmp(csinfo[j].fname, fname, FALSE) & FPC_SAME)
93 !               /* if not Windows 9x, test index file atributes too */
94                 || (!mch_windows95()
95                     && csinfo[j].nVolume == bhfi.dwVolumeSerialNumber
96                     && csinfo[j].nIndexHigh == bhfi.nFileIndexHigh
97 --- 1312,1318 ----
98   #else
99             /* compare pathnames first */
100             && ((fullpathcmp(csinfo[j].fname, fname, FALSE) & FPC_SAME)
101 !               /* if not Windows 9x, test index file attributes too */
102                 || (!mch_windows95()
103                     && csinfo[j].nVolume == bhfi.dwVolumeSerialNumber
104                     && csinfo[j].nIndexHigh == bhfi.nFileIndexHigh
105 ***************
106 *** 1401,1406 ****
107 --- 1396,1404 ----
108       if (eap->arg == NULL)
109         return NULL;
110   
111 +     /* Store length of eap->arg before it gets modified by strtok(). */
112 +     eap_arg_len = STRLEN(eap->arg);
113
114       if ((stok = strtok((char *)(eap->arg), (const char *)" ")) == NULL)
115         return NULL;
116   
117 ***************
118 *** 2195,2201 ****
119             cs_add_common(dblist[i], pplist[i], fllist[i]);
120             if (p_csverbose)
121             {
122 !               /* dont' use smsg_attr because want to display
123                  * connection number in the same line as
124                  * "Added cscope database..."
125                  */
126 --- 2193,2199 ----
127             cs_add_common(dblist[i], pplist[i], fllist[i]);
128             if (p_csverbose)
129             {
130 !               /* don't use smsg_attr() because we want to display the
131                  * connection number in the same line as
132                  * "Added cscope database..."
133                  */
134 *** ../vim-7.1.086/src/version.c        Tue Aug 21 17:29:04 2007
135 --- src/version.c       Tue Aug 21 17:59:42 2007
136 ***************
137 *** 668,669 ****
138 --- 668,671 ----
139   {   /* Add new patch number below this line */
140 + /**/
141 +     87,
142   /**/
143
144 -- 
145 hundred-and-one symptoms of being an internet addict:
146 223. You set up a web-cam as your home's security system.
147
148  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
149 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
150 \\\        download, build and distribute -- http://www.A-A-P.org        ///
151  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.035694 seconds and 3 git commands to generate.