diff --git a/Provider/main/http_server.cpp b/Provider/main/http_server.cpp index f2b756a..8602cfb 100644 --- a/Provider/main/http_server.cpp +++ b/Provider/main/http_server.cpp @@ -14,6 +14,8 @@ internal const char *TAG = "HTTP_SERVER"; +constexpr uint8 kGZ_Extension_Length = sizeof(".gz") - 1; + #define FILE_PATH_MAX (ESP_VFS_PATH_MAX + 128) #define SCRATCH_BUFSIZE 4096 @@ -58,7 +60,7 @@ internal esp_err_t static_file_handler(httpd_req_t *req) { struct stat file_stat; if (stat(filepath, &file_stat) == -1) { // Try gzipped first, then fallback to index.html - char filepath_gz[FILE_PATH_MAX + 16]; + char filepath_gz[FILE_PATH_MAX + kGZ_Extension_Length]; snprintf(filepath_gz, sizeof(filepath_gz), "%s.gz", filepath); if (stat(filepath_gz, &file_stat) == 0) { strlcpy(filepath, filepath_gz, sizeof(filepath));