Use snprintf rather than sprintf. From pvaldes.

git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@431 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Tim Cava
2013-11-07 02:41:16 +00:00
parent 590ae4c685
commit 276fd24258
41 changed files with 623 additions and 222 deletions

View File

@@ -287,7 +287,7 @@ static void show_timer (char *command)
time_left = BX_time_diff(current, tmp->time);
if (time_left < 0)
time_left = 0;
sprintf(buf, "%0.3f", time_left);
snprintf(buf, sizeof buf, "%0.3f", time_left);
put_it("%s", convert_output_format(fget_string_var(FORMAT_TIMER_FSET), "%s %s %d %s %s", tmp->ref, buf, tmp->events, tmp->callback? "(internal callback)" : (tmp->command? tmp->command : ""), tmp->whom ? tmp->whom : empty_string ));
}
}
@@ -467,7 +467,7 @@ TimerList *tmp;
time_left = BX_time_diff(current, tmp->time);
if (time_left < 0)
time_left = 0.0;
sprintf(buf, "%0.3f", time_left);
snprintf(buf, sizeof buf, "%0.3f", time_left);
malloc_sprintf(&out, "%s %d %d %d %d %s %s %s", tmp->ref, tmp->server, tmp->window, tmp->interval, tmp->events, buf, tmp->callback? "(internal callback)" : (tmp->command? tmp->command : ""), tmp->whom ? tmp->whom : empty_string );
return ref;
}