mirror of
https://github.com/mirror/wget.git
synced 2025-03-09 17:20:33 +08:00
* src/progress.c (dot_update, dot_finish): Sanitize input
This commit is contained in:
parent
f5d1dcf718
commit
542524855a
@ -348,6 +348,15 @@ print_row_stats (struct dot_progress *dp, double dltime, bool last)
|
||||
static void
|
||||
dot_update (void *progress, wgint howmuch, double dltime)
|
||||
{
|
||||
// sanitize input
|
||||
if (dltime >= INT_MAX)
|
||||
dltime = INT_MAX - 1;
|
||||
else if (dltime < 0)
|
||||
dltime = 0;
|
||||
|
||||
if (howmuch < 0)
|
||||
howmuch = 0;
|
||||
|
||||
struct dot_progress *dp = progress;
|
||||
dp->accumulated += howmuch;
|
||||
dp->dltime = dltime;
|
||||
@ -406,6 +415,12 @@ dot_finish (void *progress, double dltime)
|
||||
logputs (LOG_PROGRESS, " ");
|
||||
}
|
||||
|
||||
// sanitize input
|
||||
if (dltime >= INT_MAX)
|
||||
dltime = INT_MAX - 1;
|
||||
else if (dltime < 0)
|
||||
dltime = 0;
|
||||
|
||||
print_row_stats (dp, dltime, true);
|
||||
logputs (LOG_VERBOSE, "\n\n");
|
||||
log_set_flush (false);
|
||||
|
Loading…
Reference in New Issue
Block a user