securitymemory-safety
Memory Safety security skill
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
Memory Safety
C's primary vulnerability class. Buffer overflows, use-after-free, and integer issues remain the top attack vectors in native code.
ikigai Application
talloc mitigates but doesn't eliminate: Hierarchical ownership prevents leaks but not overflows or UAF within a context's lifetime.
Critical patterns:
- Bounds check ALL array access before use
- Validate sizes before allocation:
if (n > SIZE_MAX / elem_size) return ERR(...) - Never trust size values from external sources
- Use
talloc_array()not manual multiplication
Integer overflow risks:
-
size_tmultiplication for buffer sizes - Signed/unsigned conversion in comparisons
- Off-by-one in loop bounds
Detection tools:
- ASan (
make BUILD=sanitize) - buffer overflow, UAF - UBSan - undefined behavior, integer overflow
- Valgrind - memory errors, leaks
Review red flags: Manual pointer arithmetic, memcpy with computed sizes, array indexing without bounds check.
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-01-20
- Index updated
- 2026-01-26
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!