v0.1.6 - Just catching up

This commit is contained in:
Your Name
2025-11-11 17:02:14 -04:00
parent 35f8385508
commit 533c7f29f2
9 changed files with 184 additions and 29 deletions

View File

@@ -427,8 +427,16 @@ void handle_mirror_request(void) {
const char* extension = mime_to_extension(content_type_final);
// Save file to storage directory using global g_storage_dir variable
char filepath[512];
snprintf(filepath, sizeof(filepath), "%s/%s%s", g_storage_dir, sha256_hex, extension);
char filepath[4096];
int filepath_len = snprintf(filepath, sizeof(filepath), "%s/%s%s", g_storage_dir, sha256_hex, extension);
if (filepath_len >= (int)sizeof(filepath)) {
free_mirror_download(download);
send_error_response(500, "file_error",
"File path too long",
"Internal server error during file path construction");
log_request("PUT", "/mirror", uploader_pubkey ? "authenticated" : "anonymous", 500);
return;
}
FILE* outfile = fopen(filepath, "wb");
if (!outfile) {