]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tftp: return error when sendto() fails
authorDaniel Stenberg <daniel@haxx.se>
Sat, 20 Sep 2025 15:40:17 +0000 (17:40 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 20 Sep 2025 20:35:12 +0000 (22:35 +0200)
The code just called failf() and then continued without returning error.

Reported in Joshua's sarif data

Closes #18643

lib/tftp.c

index 7dc06261b2c402be75d5c3b8ad8923bd71869175..8b6246a34265a57a6cc566896d4c474e14a1cb12 100644 (file)
@@ -535,11 +535,12 @@ static CURLcode tftp_send_first(struct tftp_conn *state,
                       (SEND_TYPE_ARG3)sbytes, 0,
                       CURL_SENDTO_ARG5(&remote_addr->curl_sa_addr),
                       (curl_socklen_t)remote_addr->addrlen);
+    free(filename);
     if(senddata != (ssize_t)sbytes) {
       char buffer[STRERROR_LEN];
       failf(data, "%s", Curl_strerror(SOCKERRNO, buffer, sizeof(buffer)));
+      return CURLE_SEND_ERROR;
     }
-    free(filename);
     break;
 
   case TFTP_EVENT_OACK: