2007-08-01 Michael Snyder <msnyder@access-company.com>
* cli/cli-decode.c (lookup_cmd): Check for null earlier, to avoid dereference in lookup_cmd_1.
This commit is contained in:
parent
c0645fb52f
commit
3cebf8d882
|
@ -1,5 +1,8 @@
|
||||||
2007-08-01 Michael Snyder <msnyder@access-company.com>
|
2007-08-01 Michael Snyder <msnyder@access-company.com>
|
||||||
|
|
||||||
|
* cli/cli-decode.c (lookup_cmd): Check for null earlier, to
|
||||||
|
avoid dereference in lookup_cmd_1.
|
||||||
|
|
||||||
* tui/tui-data.c (tui_alloc_content): Move assign out of if,
|
* tui/tui-data.c (tui_alloc_content): Move assign out of if,
|
||||||
clean up long lines.
|
clean up long lines.
|
||||||
(tui_alloc_generic_win_info): Tidy by using XMALLOC macro.
|
(tui_alloc_generic_win_info): Tidy by using XMALLOC macro.
|
||||||
|
|
|
@ -1226,28 +1226,27 @@ lookup_cmd (char **line, struct cmd_list_element *list, char *cmdtype,
|
||||||
int allow_unknown, int ignore_help_classes)
|
int allow_unknown, int ignore_help_classes)
|
||||||
{
|
{
|
||||||
struct cmd_list_element *last_list = 0;
|
struct cmd_list_element *last_list = 0;
|
||||||
struct cmd_list_element *c =
|
struct cmd_list_element *c;
|
||||||
lookup_cmd_1 (line, list, &last_list, ignore_help_classes);
|
|
||||||
|
|
||||||
/* Note: Do not remove trailing whitespace here because this
|
/* Note: Do not remove trailing whitespace here because this
|
||||||
would be wrong for complete_command. Jim Kingdon */
|
would be wrong for complete_command. Jim Kingdon */
|
||||||
|
|
||||||
|
if (!*line)
|
||||||
|
error (_("Lack of needed %scommand"), cmdtype);
|
||||||
|
|
||||||
|
c = lookup_cmd_1 (line, list, &last_list, ignore_help_classes);
|
||||||
|
|
||||||
if (!c)
|
if (!c)
|
||||||
{
|
{
|
||||||
if (!allow_unknown)
|
if (!allow_unknown)
|
||||||
{
|
{
|
||||||
if (!*line)
|
char *q;
|
||||||
error (_("Lack of needed %scommand"), cmdtype);
|
int len = find_command_name_length (*line);
|
||||||
else
|
|
||||||
{
|
|
||||||
char *q;
|
|
||||||
int len = find_command_name_length (*line);
|
|
||||||
|
|
||||||
q = (char *) alloca (len + 1);
|
q = (char *) alloca (len + 1);
|
||||||
strncpy (q, *line, len);
|
strncpy (q, *line, len);
|
||||||
q[len] = '\0';
|
q[len] = '\0';
|
||||||
undef_cmd_error (cmdtype, q);
|
undef_cmd_error (cmdtype, q);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue