]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tftp: propagate expired timer from tftp_state_timeout()
authorJoshua Rogers <MegaManSec@users.noreply.github.com>
Tue, 16 Sep 2025 19:52:28 +0000 (00:52 +0500)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 18 Sep 2025 15:34:31 +0000 (17:34 +0200)
When Curl_timeleft() < 0 we used to return 0, masking the expiry and
skipping the caller’s (timeout_ms < 0) path. Now we set FIN and return
the negative value so tftp_multi_statemach() aborts with
CURLE_OPERATION_TIMEDOUT as intended.

Closes #18574

lib/tftp.c

index 4c2fadc2caf8d6d45c9a8718085cb448c81c4b3a..620ab1e70df87c1ee352f17a93c4eaae2f819a96 100644 (file)
@@ -1184,7 +1184,7 @@ static timediff_t tftp_state_timeout(struct tftp_conn *state,
   if(timeout_ms < 0) {
     state->error = TFTP_ERR_TIMEOUT;
     state->state = TFTP_STATE_FIN;
-    return 0;
+    return timeout_ms;
   }
   current = time(NULL);
   if(current > state->rx_time + state->retry_time) {