diff options
author | ng0 <ng0@n0.is> | 2019-08-15 09:52:39 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-08-15 09:52:39 +0000 |
commit | 36fb08f81b748620e97d7d8e2d4255b77e78c545 (patch) | |
tree | 19aa5019c9e9cbf53d74e272fddc8cbc48b39e51 /src/tool_cb_prg.c | |
parent | 765f80c1e27acb585eebef46a97ffc769e452879 (diff) | |
parent | aa73eb47bc8583070734696b25b34ad54c2c1f5e (diff) | |
download | gnurl-36fb08f81b748620e97d7d8e2d4255b77e78c545.tar.gz gnurl-36fb08f81b748620e97d7d8e2d4255b77e78c545.tar.bz2 gnurl-36fb08f81b748620e97d7d8e2d4255b77e78c545.zip |
Merge tag 'curl-7_65_3'
7.65.3
Diffstat (limited to 'src/tool_cb_prg.c')
-rw-r--r-- | src/tool_cb_prg.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/tool_cb_prg.c b/src/tool_cb_prg.c index e2ee54225..a18827c8b 100644 --- a/src/tool_cb_prg.c +++ b/src/tool_cb_prg.c @@ -125,14 +125,19 @@ int tool_progress_cb(void *clientp, curl_off_t total; curl_off_t point; - /* expected transfer size */ - if((CURL_OFF_T_MAX - bar->initial_size) < (dltotal + ultotal)) + /* Calculate expected transfer size. initial_size can be less than zero + when indicating that we are expecting to get the filesize from the + remote */ + if(bar->initial_size < 0 || + ((CURL_OFF_T_MAX - bar->initial_size) < (dltotal + ultotal))) total = CURL_OFF_T_MAX; else total = dltotal + ultotal + bar->initial_size; - /* we've come this far */ - if((CURL_OFF_T_MAX - bar->initial_size) < (dlnow + ulnow)) + /* Calculate the current progress. initial_size can be less than zero when + indicating that we are expecting to get the filesize from the remote */ + if(bar->initial_size < 0 || + ((CURL_OFF_T_MAX - bar->initial_size) < (dlnow + ulnow))) point = CURL_OFF_T_MAX; else point = dlnow + ulnow + bar->initial_size; @@ -205,7 +210,8 @@ void progressbarinit(struct ProgressData *bar, if(colp) { char *endptr; long num = strtol(colp, &endptr, 10); - if((endptr != colp) && (endptr == colp + strlen(colp)) && (num > 20)) + if((endptr != colp) && (endptr == colp + strlen(colp)) && (num > 20) && + (num < 10000)) bar->width = (int)num; curl_free(colp); } |