mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 01:03:14 +02:00
core: fix integer overflow in loops (issue #2178)
This commit is contained in:
@@ -269,6 +269,7 @@ hook_line_add_to_infolist (struct t_infolist_item *item,
|
||||
void
|
||||
hook_line_print_log (struct t_hook *hook)
|
||||
{
|
||||
char **ptr_tag;
|
||||
int i, j;
|
||||
|
||||
if (!hook || !hook->hook_data)
|
||||
@@ -290,12 +291,10 @@ hook_line_print_log (struct t_hook *hook)
|
||||
{
|
||||
for (i = 0; i < HOOK_LINE(hook, tags_count); i++)
|
||||
{
|
||||
for (j = 0; HOOK_LINE(hook, tags_array)[i][j]; j++)
|
||||
for (ptr_tag = HOOK_LINE(hook, tags_array)[i], j = 0; *ptr_tag;
|
||||
ptr_tag++, j++)
|
||||
{
|
||||
log_printf (" tags_array[%03d][%03d]: '%s'",
|
||||
i,
|
||||
j,
|
||||
HOOK_LINE(hook, tags_array)[i][j]);
|
||||
log_printf (" tags_array[%03d][%03d]: '%s'", i, j, *ptr_tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,6 +249,7 @@ hook_print_add_to_infolist (struct t_infolist_item *item,
|
||||
void
|
||||
hook_print_print_log (struct t_hook *hook)
|
||||
{
|
||||
char **ptr_tag;
|
||||
int i, j;
|
||||
|
||||
if (!hook || !hook->hook_data)
|
||||
@@ -263,12 +264,10 @@ hook_print_print_log (struct t_hook *hook)
|
||||
{
|
||||
for (i = 0; i < HOOK_PRINT(hook, tags_count); i++)
|
||||
{
|
||||
for (j = 0; HOOK_PRINT(hook, tags_array)[i][j]; j++)
|
||||
for (ptr_tag = HOOK_PRINT(hook, tags_array)[i], j = 0; *ptr_tag;
|
||||
ptr_tag++, j++)
|
||||
{
|
||||
log_printf (" tags_array[%03d][%03d]: '%s'",
|
||||
i,
|
||||
j,
|
||||
HOOK_PRINT(hook, tags_array)[i][j]);
|
||||
log_printf (" tags_array[%03d][%03d]: '%s'", i, j, *ptr_tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ hook_process (struct t_weechat_plugin *plugin,
|
||||
void
|
||||
hook_process_child (struct t_hook *hook_process)
|
||||
{
|
||||
char **exec_args, *arg0, str_arg[64];
|
||||
char **exec_args, *arg0, str_arg[64], **ptr_exec_arg;
|
||||
const char *ptr_url, *ptr_arg;
|
||||
int rc, i, num_args;
|
||||
FILE *f;
|
||||
@@ -353,9 +353,10 @@ hook_process_child (struct t_hook *hook_process)
|
||||
{
|
||||
log_printf ("hook_process, command='%s'",
|
||||
HOOK_PROCESS(hook_process, command));
|
||||
for (i = 0; exec_args[i]; i++)
|
||||
for (ptr_exec_arg = exec_args, i = 0; *ptr_exec_arg;
|
||||
ptr_exec_arg++, i++)
|
||||
{
|
||||
log_printf (" args[%02d] == '%s'", i, exec_args[i]);
|
||||
log_printf (" args[%d] == '%s'", i, *ptr_exec_arg);
|
||||
}
|
||||
}
|
||||
execvp (exec_args[0], exec_args);
|
||||
|
||||
Reference in New Issue
Block a user