c-string-and-buffer-safety

Installation
SKILL.md

C String & Buffer Safety

When to use

  • Writing C that copies user-controlled or variable-length strings into fixed buffers.
  • Reviewing code that uses strncpy, snprintf, strcpy, strcat, sprintf, gets, memcpy, memset.
  • Checking whether a buffer is large enough for what is copied into it.
  • Reasoning about truncation: does the call report when the output was cut off?
  • Porting code between BSD (strlcpy/strscpy), Linux kernel, and standard C11 environments.

When not to use

  • Pure C++ code with std::string / std::vector — see raii-descriptor-types-api-design.
  • Rust — ownership + bounds checks are compile-time; use rust-unsafe-reasoning for unsafe blocks.
  • When the concern is a specific UB construct rather than string copying, route through c-undefined-behavior.
  • Memory allocation correctness (leaks, double-free) — that is memory ownership, not buffer sizing.

What the agent often gets wrong

Installs
1
GitHub Stars
2
First Seen
Oct 3, 2026