Skip to content

telnet: honor CURLOPT_TIMEOUT in send_telnet_data()#21685

Closed
MegaManSec wants to merge 1 commit into
curl:masterfrom
MegaManSec:telnet-send-timeout
Closed

telnet: honor CURLOPT_TIMEOUT in send_telnet_data()#21685
MegaManSec wants to merge 1 commit into
curl:masterfrom
MegaManSec:telnet-send-timeout

Conversation

@MegaManSec

Copy link
Copy Markdown
Contributor

The poll-before-write loop in send_telnet_data() passed -1 to
Curl_poll(), making the wait infinite. A peer that accepts the
connection but stops reading fills the TCP send buffer, causing
Curl_poll() to block indefinitely and bypassing CURLOPT_TIMEOUT.

Fix: use Curl_timeleft_ms() for the poll timeout and return
CURLE_OPERATION_TIMEDOUT when the deadline is reached.

The poll-before-write loop used -1 (infinite) as the Curl_poll timeout,
so a peer that stops reading could stall the transfer indefinitely,
bypassing CURLOPT_TIMEOUT. Use Curl_timeleft_ms() instead and return
CURLE_OPERATION_TIMEDOUT when the deadline is reached or exceeded.
@bagder bagder closed this in d191de8 Jun 2, 2026
@bagder

bagder commented Jun 2, 2026

Copy link
Copy Markdown
Member

Thanks!

outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
The poll-before-write loop used -1 (infinite) as the Curl_poll timeout,
so a peer that stops reading could stall the transfer indefinitely,
bypassing CURLOPT_TIMEOUT. Use Curl_timeleft_ms() instead and return
CURLE_OPERATION_TIMEDOUT when the deadline is reached or exceeded.

Closes curl#21685
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants