telnet: honor CURLOPT_TIMEOUT in send_telnet_data()#21685
Closed
MegaManSec wants to merge 1 commit into
Closed
Conversation
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
approved these changes
Jun 2, 2026
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The poll-before-write loop in
send_telnet_data()passed-1toCurl_poll(), making the wait infinite. A peer that accepts theconnection but stops reading fills the TCP send buffer, causing
Curl_poll()to block indefinitely and bypassingCURLOPT_TIMEOUT.Fix: use
Curl_timeleft_ms()for the poll timeout and returnCURLE_OPERATION_TIMEDOUTwhen the deadline is reached.