You are viewing a single thread.
View all comments
24 points

I don’t speak C, but isn’t this an extreme simplification of the issue? I thought memory could be abused in an almost infinite number of subtle ways outside of allocating it wrong. For example, improperly sanitized string inputs. I feel like if it were this easy, it would have been done decades ago.

permalink
report
reply
8 points

Buffer overflows are far from the only way for improperly sanitized inputs to be a problem

permalink
report
parent
reply
4 points

Use after free, null pointer dereference, double free.

Solutions to these in C end up looking a lot like Rust.

permalink
report
parent
reply
3 points

Yes. If you disabled unions and pointer casts, basically no C code would compile.

permalink
report
parent
reply
-7 points

I think this can be explained by underlining the differences between could, would, and should.

The blog states the fact that at least some C compilers already offer the necessary and sufficient tools that characterize “memory-safe” languages, and proceeds to illustrate examples. This isn’t new. However, just like “memory-safe” languages enforce narrow coding styles through a happy path that is expected to prevent the introduction of some classes of vulnerabilities, leveraging these compiler features in C projects also requires the same type of approach.

This isn’t new or unheard of. Some C++ frameworks are also known for supporting their own memory management and object ownership strategies, but you need to voluntarily adhere to them.

permalink
report
parent
reply

C Programming Language

!c_lang@programming.dev

Create post

Welcome to the C community!

C is quirky, flawed, and an enormous success.
When I read commentary about suggestions for where C should go, I often think back and give thanks that it wasn’t developed under the advice of a worldwide crowd.
The only way to learn a new programming language is by writing programs in it.

© Dennis Ritchie

🌐 https://en.cppreference.com/w/c

Community stats

  • 59

    Monthly active users

  • 54

    Posts

  • 191

    Comments