From b67db2af4c3fd5bc8c612c6348c78323f5bf4b48 Mon Sep 17 00:00:00 2001 From: cflip Date: Thu, 8 Jun 2023 15:51:42 -0600 Subject: Check file extension for NULL --- file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/file.c b/file.c index 1c85bdd..b64480c 100644 --- a/file.c +++ b/file.c @@ -63,6 +63,8 @@ enum serve_method file_method_for_path(const char *filepath, enum http_res_code static const char *mime_type_for_path(const char *filepath) { const char *ext = strrchr(filepath, '.'); + if (ext == NULL) + return "text/plain"; if (strcmp(ext, ".html") == 0) return "text/html"; if (strcmp(ext, ".css") == 0) -- cgit v1.2.3