summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortiptorrent development team <tiptorrent@soleta.eu>2022-02-12 12:40:33 +0100
committertiptorrent development team <tiptorrent@soleta.eu>2022-02-12 12:40:33 +0100
commitcc67335f13b62c177ab2c511a95d2bf31a986170 (patch)
tree396c11fe2fb64e1f89b493c8326c08e24d6073c1 /src
parentdb94ee6ef80848d1c383faccb045b139ed8dacc4 (diff)
validate received bytes and expected file size
Diffstat (limited to 'src')
-rw-r--r--src/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index b48fc78..1372437 100644
--- a/src/main.c
+++ b/src/main.c
@@ -616,6 +616,12 @@ err:
gettimeofday(&tv_stop, NULL);
timersub(&tv_stop, &tv_start, &tv);
+ if (data_len != file_size) {
+ syslog(LOG_ERR, "Failure, file size is %lu bytes but received %lu bytes!\n",
+ file_size, data_len);
+ return EXIT_FAILURE;
+ }
+
if (_cli.state == TIP_CLIENT_DONE) {
printf("OK.\n");
syslog(LOG_INFO, "Done in %lu.%06lu seconds (%lu Mbytes/second). "