null-pointer-dereference

Solid

Detects code that dereferences pointers or return values that could be NULL without validation, causing crashes or privilege escalation.

Data & Documents 32 stars 10 forks Updated 2 months ago NOASSERTION

Install

View on GitHub

Quality Score: 72/100

Stars 20%
51
Recency 20%
75
Frontmatter 20%
70
Documentation 15%
47
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Null Pointer Dereference ## Overview Null pointer dereference occurs when code uses a pointer without checking whether it's NULL. This causes: - **Crash/DoS**: SIGSEGV on Unix, access violation on Windows - **Kernel privilege escalation**: NULL pointer dereference in kernel context can map page 0 and execute attacker code - **Logic bypass**: Skipping NULL checks allows unexpected code paths ## Detection Strategy - Return values of `malloc()`, `calloc()`, `realloc()` used without NULL check - Results of `fopen()`, `popen()` dereferenced without NULL check - Java objects returned from `getById()` or map lookups used without null check ## Remediation Always check pointers for NULL before dereferencing. **Vulnerable (C):** ```c char *buf = malloc(256); strcpy(buf, input); // buf might be NULL if malloc failed! ``` **Safe (C):** ```c char *buf = malloc(256); if (buf == NULL) { perror("malloc"); exit(1); } strcpy(buf, input); ```

Details

Author
zakirkun
Repository
zakirkun/ice-tea
Created
2 months ago
Last Updated
2 months ago
Language
Go
License
NOASSERTION

Similar Skills

Semantically similar based on skill content — not just same category