4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
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)
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
24 static csinfo_T csinfo[CSCOPE_MAX_CONNECTIONS];
25 + static int eap_arg_len; /* length of eap->arg, set in
27 static cscmd_T cs_cmds[] =
33 if ((p = cs_manage_matches(NULL, NULL, -1, Get)) == NULL)
36 ! if ((int)strlen(p) > size)
38 ! strncpy((char *)buf, p, size - 1);
42 ! (void)strcpy((char *)buf, p);
48 if ((p = cs_manage_matches(NULL, NULL, -1, Get)) == NULL)
50 ! vim_strncpy(buf, (char_u *)p, size - 1);
58 * add cscope database or a directory name (to look for cscope.out)
59 ! * the the cscope connection list
66 * add cscope database or a directory name (to look for cscope.out)
67 ! * to the cscope connection list
75 pat = opt + strlen(opt) + 1;
76 ! if (pat == NULL || (pat != NULL && pat[0] == '\0'))
83 pat = opt + strlen(opt) + 1;
84 ! if (pat >= (char *)eap->arg + eap_arg_len)
91 /* compare pathnames first */
92 && ((fullpathcmp(csinfo[j].fname, fname, FALSE) & FPC_SAME)
93 ! /* if not Windows 9x, test index file atributes too */
95 && csinfo[j].nVolume == bhfi.dwVolumeSerialNumber
96 && csinfo[j].nIndexHigh == bhfi.nFileIndexHigh
99 /* compare pathnames first */
100 && ((fullpathcmp(csinfo[j].fname, fname, FALSE) & FPC_SAME)
101 ! /* if not Windows 9x, test index file attributes too */
103 && csinfo[j].nVolume == bhfi.dwVolumeSerialNumber
104 && csinfo[j].nIndexHigh == bhfi.nFileIndexHigh
108 if (eap->arg == NULL)
111 + /* Store length of eap->arg before it gets modified by strtok(). */
112 + eap_arg_len = STRLEN(eap->arg);
114 if ((stok = strtok((char *)(eap->arg), (const char *)" ")) == NULL)
119 cs_add_common(dblist[i], pplist[i], fllist[i]);
122 ! /* dont' use smsg_attr because want to display
123 * connection number in the same line as
124 * "Added cscope database..."
127 cs_add_common(dblist[i], pplist[i], fllist[i]);
130 ! /* don't use smsg_attr() because we want to display the
131 * connection number in the same line as
132 * "Added cscope database..."
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
139 { /* Add new patch number below this line */
145 hundred-and-one symptoms of being an internet addict:
146 223. You set up a web-cam as your home's security system.
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 ///