]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tftp: error requests for blank filenames
authorDaniel Stenberg <daniel@haxx.se>
Sun, 12 Oct 2025 09:38:39 +0000 (11:38 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 12 Oct 2025 13:37:07 +0000 (15:37 +0200)
Reported-by: Joshua Rogers
Closes #19033

lib/tftp.c

index 8279f29e650e83ce4846358d3f02292f091ffe15..0a9b8a8e870b61f0d981c3224921f64ee862365c 100644 (file)
@@ -460,6 +460,10 @@ static CURLcode tftp_send_first(struct tftp_conn *state,
     /* As RFC3617 describes the separator slash is not actually part of the
        filename so we skip the always-present first letter of the path
        string. */
+    if(!state->data->state.up.path[1]) {
+      failf(data, "Missing filename");
+      return CURLE_TFTP_ILLEGAL;
+    }
     result = Curl_urldecode(&state->data->state.up.path[1], 0,
                             &filename, NULL, REJECT_ZERO);
     if(result)