Hacker News new | ask | show | jobs
by 0xbadcafebee 23 days ago
This shows you how you could "secure" memory code in C by using more robust implementations of these functions. But it doesn't show you that you don't even need them anyway. I think in my entire career I've only used dynamic memory in C twice. The rest of the time I use functions with static allocations, buffers, unrolled loops, etc. Maybe it's paranoia, or habits from embedded programming, or being a control freak... But my C programs don't get memory leaks or crash from memory issues.
1 comments

You can secure part of C with robust memory-handling functions. So long as people are using --> and ++ to parallel iterate through buffers where they have to pass the right length around separate from its pointer though, you're not going to fix it all.