It's actually pretty simple to write secure C code, if you take a few simple precautions.
1) Always use fixed size arrays, declared in global scope for main access.
2) Allow the user to use format specifiers in input strings, for as the saying goes, "%s %02X %.02f"
3) Never use the the functions
>>2 described, they are dangerous.