safe-c-functions
Installation
SKILL.md
C/C++ Memory and String Safety
Actively identify, flag, and provide secure refactoring options for insecure memory and string functions. When generating new code, always default to the safest function available.
Insecure Functions and Safe Alternatives
Critical / High Risk
gets() -- Critical. No bounds checking whatsoever. Always replace with:
fgets(char *str, int n, FILE *stream)
strcpy() -- High risk. Copies until null terminator with no bounds check. Replace with:
snprintf(),strcpy_s()(C11 Annex K), orstrncpy()(with manual null termination)
strcat() -- High risk. Appends with no bounds check. Replace with:
snprintf(),strcat_s()(C11 Annex K), orstrncat()(with careful handling)
sprintf() / vsprintf() -- High risk. No output buffer bounds check. Replace with:
snprintf(),vsprintf_s()(C11 Annex K)