Enhance error handling for HTTP/2 file size, validate mmap cache entries, improve WebSocket connection handling, enforce maximum URI length, and limit WebSocket payload size.

This commit is contained in:
2025-11-02 12:22:12 +01:00
parent 636b221d62
commit 01874b0e5a
4 changed files with 71 additions and 6 deletions

View File

@@ -122,6 +122,12 @@ mmap_cache_entry_t *get_cached_file(const char *path)
{
if (mmap_cache[i].path && strcmp(mmap_cache[i].path, path) == 0)
{
if (mmap_cache[i].mmap_data == NULL || mmap_cache[i].size == 0)
{
pthread_mutex_unlock(&mmap_cache_mutex);
return NULL;
}
mmap_cache[i].last_access = time(NULL);
mmap_cache[i].ref_count++;
pthread_mutex_unlock(&mmap_cache_mutex);