mirror of
https://github.com/sheumann/hush.git
synced 2024-12-23 05:29:58 +00:00
inetd: fix order of array index check and array access
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
3aef814c0b
commit
2ec4f44225
@ -645,7 +645,7 @@ static servtab_t *dup_servtab(servtab_t *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* gcc generates much more code if this is inlined */
|
/* gcc generates much more code if this is inlined */
|
||||||
static servtab_t *parse_one_line(void)
|
static NOINLINE servtab_t *parse_one_line(void)
|
||||||
{
|
{
|
||||||
int argc;
|
int argc;
|
||||||
char *token[6+MAXARGV];
|
char *token[6+MAXARGV];
|
||||||
@ -675,6 +675,8 @@ static servtab_t *parse_one_line(void)
|
|||||||
* default host for the following lines. */
|
* default host for the following lines. */
|
||||||
free(default_local_hostname);
|
free(default_local_hostname);
|
||||||
default_local_hostname = sep->se_local_hostname;
|
default_local_hostname = sep->se_local_hostname;
|
||||||
|
/*sep->se_local_hostname = NULL; - redundant */
|
||||||
|
/* (we'll overwrite this field anyway) */
|
||||||
goto more;
|
goto more;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -688,10 +690,10 @@ static servtab_t *parse_one_line(void)
|
|||||||
parse_err:
|
parse_err:
|
||||||
bb_error_msg("parse error on line %u, line is ignored",
|
bb_error_msg("parse error on line %u, line is ignored",
|
||||||
parser->lineno);
|
parser->lineno);
|
||||||
free_servtab_strings(sep);
|
|
||||||
/* Just "goto more" can make sep to carry over e.g.
|
/* Just "goto more" can make sep to carry over e.g.
|
||||||
* "rpc"-ness (by having se_rpcver_lo != 0).
|
* "rpc"-ness (by having se_rpcver_lo != 0).
|
||||||
* We will be more paranoid: */
|
* We will be more paranoid: */
|
||||||
|
free_servtab_strings(sep);
|
||||||
free(sep);
|
free(sep);
|
||||||
goto new;
|
goto new;
|
||||||
}
|
}
|
||||||
@ -815,7 +817,7 @@ static servtab_t *parse_one_line(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
argc = 0;
|
argc = 0;
|
||||||
while ((arg = token[6+argc]) != NULL && argc < MAXARGV)
|
while (argc < MAXARGV && (arg = token[6+argc]) != NULL)
|
||||||
sep->se_argv[argc++] = xstrdup(arg);
|
sep->se_argv[argc++] = xstrdup(arg);
|
||||||
/* Some inetd.conf files have no argv's, not even argv[0].
|
/* Some inetd.conf files have no argv's, not even argv[0].
|
||||||
* Fix them up.
|
* Fix them up.
|
||||||
|
Loading…
Reference in New Issue
Block a user