mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.0.0213: Netbeans specialKeys command does not check argument length
Problem: The Netbeans "specialKeys" command does not check if the argument fits in the buffer. (Coverity) Solution: Add a length check.
This commit is contained in:
@@ -2332,7 +2332,8 @@ special_keys(char_u *args)
|
|||||||
char *save_str = nb_unquote(args, NULL);
|
char *save_str = nb_unquote(args, NULL);
|
||||||
char *tok = strtok(save_str, " ");
|
char *tok = strtok(save_str, " ");
|
||||||
char *sep;
|
char *sep;
|
||||||
char keybuf[64];
|
#define KEYBUFLEN 64
|
||||||
|
char keybuf[KEYBUFLEN];
|
||||||
char cmdbuf[256];
|
char cmdbuf[256];
|
||||||
|
|
||||||
while (tok != NULL)
|
while (tok != NULL)
|
||||||
@@ -2359,10 +2360,13 @@ special_keys(char_u *args)
|
|||||||
tok++;
|
tok++;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(&keybuf[i], tok);
|
if (strlen(tok) + i < KEYBUFLEN)
|
||||||
vim_snprintf(cmdbuf, sizeof(cmdbuf),
|
{
|
||||||
"<silent><%s> :nbkey %s<CR>", keybuf, keybuf);
|
strcpy(&keybuf[i], tok);
|
||||||
do_map(0, (char_u *)cmdbuf, NORMAL, FALSE);
|
vim_snprintf(cmdbuf, sizeof(cmdbuf),
|
||||||
|
"<silent><%s> :nbkey %s<CR>", keybuf, keybuf);
|
||||||
|
do_map(0, (char_u *)cmdbuf, NORMAL, FALSE);
|
||||||
|
}
|
||||||
tok = strtok(NULL, " ");
|
tok = strtok(NULL, " ");
|
||||||
}
|
}
|
||||||
vim_free(save_str);
|
vim_free(save_str);
|
||||||
|
@@ -764,6 +764,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
213,
|
||||||
/**/
|
/**/
|
||||||
212,
|
212,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user