summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens2026-04-23 22:15:50 +0000
committerHauke Mehrtens2026-06-07 11:23:46 +0000
commit4c4a61a69ac39db20dad8dd556f235f1ae6523a3 (patch)
tree7b775cc4c739da72f96d34604d1da89722e51158
parent568c447950c1f7265767b954198daff0d8806675 (diff)
downloaduclient-4c4a61a69ac39db20dad8dd556f235f1ae6523a3.tar.gz
uclient-fetch: use strtoull to parse Content-Length
out_len is off_t, which is 64-bit on most builds. Parsing with strtoul() truncated upper bits on 32-bit platforms where long is 32-bit, capping reported sizes at 4 GiB and breaking progress/ETA reporting for larger downloads. Assisted-by: Claude:claude-opus-4-7 Link: https://github.com/openwrt/uclient/pull/16 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--uclient-fetch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/uclient-fetch.c b/uclient-fetch.c
index 39347e4..2afa3fd 100644
--- a/uclient-fetch.c
+++ b/uclient-fetch.c
@@ -249,7 +249,7 @@ static void header_done_cb(struct uclient *cl)
break;
if (tb[H_LEN])
- out_len = strtoul(blobmsg_get_string(tb[H_LEN]), NULL, 10);
+ out_len = strtoull(blobmsg_get_string(tb[H_LEN]), NULL, 10);
output_fd = open_output_file(cl->url->location, resume_offset);
if (output_fd < 0) {