Skip to content

[deft-security] Fix CWE-416: Use After Free in src/cache.c#29

Open
539hex wants to merge 1 commit intomainfrom
deft-security/src-cache.c-d26c742b
Open

[deft-security] Fix CWE-416: Use After Free in src/cache.c#29
539hex wants to merge 1 commit intomainfrom
deft-security/src-cache.c-d26c742b

Conversation

@539hex
Copy link
Owner

@539hex 539hex commented Mar 4, 2026

Security Fixes

File: src/cache.c
Highest Severity: HIGH
Fixes Applied: 1

CWE-416: Use After Free

  • Severity: HIGH
  • Confidence: 95%
  • After freeing the hash table in free_cache(), the global pointer memory_cache isn't set to NULL. If another thread calls add_to_cache() after free_cache(), it would reinitialize memory_cache with a new hash table. However, if the freed hash table's memory is reallocated elsewhere, accessing the old pointer could lead to use-after-free. The lack of NULL assignment leaves a dangling pointer risk.

Automated by deft.is code scanning

Automated security fix by deft.is
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant