Fixes from CodeQL (#223)

* Fix code scanning alert no. 4: Multiplication result converted to larger type

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Fix code scanning alert no. 5: Multiplication result converted to larger type

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
SashaXser 2024-11-05 19:19:32 +04:00 committed by GitHub
parent 0a06ba41c9
commit 75671fa11c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -469,7 +469,7 @@ ssize_t desync(int sfd, char *buffer, size_t bfsize,
pos += gen_offset(part.pos, pos += gen_offset(part.pos,
part.flag, n - pos - 5, lp, type, host_pos - 5, len); part.flag, n - pos - 5, lp, type, host_pos - 5, len);
pos += part.s * (part.r - r); pos += (long)part.s * (part.r - r);
if (pos < lp) { if (pos < lp) {
LOG(LOG_E, "tlsrec cancel: %ld < %ld\n", pos, lp); LOG(LOG_E, "tlsrec cancel: %ld < %ld\n", pos, lp);
break; break;
@ -501,7 +501,7 @@ ssize_t desync(int sfd, char *buffer, size_t bfsize,
long pos = gen_offset(part.pos, long pos = gen_offset(part.pos,
part.flag, n, lp, type, host_pos, len); part.flag, n, lp, type, host_pos, len);
pos += part.s * (part.r - r); pos += (long)part.s * (part.r - r);
if (!(part.flag & OFFSET_START) && offset && pos <= offset) { if (!(part.flag & OFFSET_START) && offset && pos <= offset) {
LOG(LOG_S, "offset: %zd, skip\n", offset); LOG(LOG_S, "offset: %zd, skip\n", offset);