diff options
| author | cflip <cflip@cflip.net> | 2023-06-08 15:51:42 -0600 |
|---|---|---|
| committer | cflip <cflip@cflip.net> | 2023-06-08 15:51:42 -0600 |
| commit | b67db2af4c3fd5bc8c612c6348c78323f5bf4b48 (patch) | |
| tree | 6dc21e6ac8616365a303ec15b642ea034e8afa7f | |
| parent | 33657410d794112aebbf0e3c3b2f8a9bccc64bf9 (diff) | |
Check file extension for NULL
| -rw-r--r-- | file.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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) |
