mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-11-05 11:33:23 -05:00
io: cap MSG_IO_TIMEOUT value to prevent signed integer overflow
A malicious server can send MSG_IO_TIMEOUT with val near INT_MAX (0x7FFFFFFF). The existing val <= 0 guard prevents timeout disabling, but a large positive value passes through to set_io_timeout() where (io_timeout + 1) / 2 overflows signed int, wrapping allowed_lull and select_timeout negative. Every subsequent select() returns EINVAL immediately, trapping the client in a tight CPU loop. Cap the accepted timeout at 86400 seconds (24 hours), which is well above any practical timeout and avoids the overflow in set_io_timeout(). Reported-by: z3r0s <https://github.com/z3r0s6>
This commit is contained in:
500 Internal Server Error
Gitea Version: 1.28.0+dev-477-g8b6ad49a5f