diff options
author | tiptorrent development team <tiptorrent@soleta.eu> | 2022-02-12 12:40:33 +0100 |
---|---|---|
committer | tiptorrent development team <tiptorrent@soleta.eu> | 2022-02-12 12:40:33 +0100 |
commit | cc67335f13b62c177ab2c511a95d2bf31a986170 (patch) | |
tree | 396c11fe2fb64e1f89b493c8326c08e24d6073c1 | |
parent | db94ee6ef80848d1c383faccb045b139ed8dacc4 (diff) |
validate received bytes and expected file size
-rw-r--r-- | src/main.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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). " |