X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit-ng%2Fstatic.c;h=73a8411e5650dfa648e5add27aa93086a9de4e0f;hb=03d5df9a4e11ce16fbfeac4ad03f2825591fa4ae;hp=207cbabdb634c4f9be9f4b9b7c9baea09ca71260;hpb=52b6f96d74b3faf7e25f87618493c1ffd8cc3571;p=citadel.git diff --git a/webcit-ng/static.c b/webcit-ng/static.c index 207cbabdb..73a8411e5 100644 --- a/webcit-ng/static.c +++ b/webcit-ng/static.c @@ -25,12 +25,12 @@ void output_static(struct http_transaction *h) snprintf(filename, sizeof filename, "static/%s", &h->uri[8]); - if (strstr(filename, "../")) { // 100% guaranteed attacker. - do_404(h); // Die in a car fire. + if (strstr(filename, "../")) { // 100% guaranteed attacker. + do_404(h); // Die in a car fire. return; } - FILE *fp = fopen(filename, "r"); // Try to open the requested file. + FILE *fp = fopen(filename, "r"); // Try to open the requested file. if (fp == NULL) { do_404(h); return; @@ -41,11 +41,10 @@ void output_static(struct http_transaction *h) h->response_body = malloc(h->response_body_length); if (h->response_body != NULL) { fread(h->response_body, h->response_body_length, 1, fp); - } - else { + } else { h->response_body_length = 0; } - fclose(fp); // Content is now in memory. + fclose(fp); // Content is now in memory. h->response_code = 200; h->response_string = strdup("OK");