We still have software running in excel macros that control web browsers via COM. C is nothing compared to the attack surface of that.
We still have software running in excel macros that control web browsers via COM. C is nothing compared to the attack surface of that.
Even the analogy holds up in this regard: using other materials instead of asbestos does not remove all the construction problems.
I think C has other things going for it (simplicity of the compiler), just wanted to point that out.
According to studies done at Google and Microsoft, about 70% of their serious security issues are a result of memory safety errors.
>Around 70 percent of all the vulnerabilities in Microsoft products addressed through a security update each year are memory safety issues; a Microsoft engineer revealed last week at a security conference.
https://www.zdnet.com/article/microsoft-70-percent-of-all-se...
and
>Nearly 70% of the high severity security bugs in Chrome's code are memory unsafety problems, Google's engineers have revealed.
https://tech.hindustantimes.com/tech/news/70-of-security-bug...
And in discussions like this, it's verging on the dishonest - leading with a large number makes readers think that a large difference to bug count will result.
> Around 70 percent of all the vulnerabilities in Microsoft products addressed through a security update each year are memory safety issues; a Microsoft engineer revealed last week at a security conference.
What's the total bug count?
A codebase with 10000 bugs logged against it might have maybe 10[1] that are CVEs, of which, according to that statistic, only 7 would be fixed by moving to a safer language (either GC or Rust or similar).
That's just not enough motivation for switching when the payoff for preventing "70% of CVEs" is so small it may never even happen.
[1] I've worked on C codebases that were developed over a decade, and 1000:1 of all-bugs:memory-safety-bugs is a very conservative ratio. IME, it's been closer to 10000:1.
Microsoft does not appear to agree.
>Mark Russinovich, the chief technology officer of Microsoft Azure, says developers should avoid using C or C++ programming languages in new projects and instead use Rust because of security and reliability concerns.
https://www.zdnet.com/article/programming-languages-its-time...
Getting rid of a class of errors (correctness) allows you to focus more on other errors (logical). It could be argued that it could slightly reduce the likelihood of the latter.
"It will solve memory leaks!"
...
"whoops, you can still leak memory in garbage collected languages, my bad everyone!".
I say this as someone who does high-level languages as a day job, and doesn't find them to be a problem personally, but, yeah, Java as a concept still allows some unintuitive footguns like that.
Difference in magnitude of impact, difference in the response of the standards organizations in handling it, but yeah it's certainly same kind of footgun as C lets you do. The difference being that Java has devoted an enormous amount of resources to squashing these errors and they largely aren't a problem anymore, where C is afraid to touch the "undefined behavior" and "implementation dependent" sacred cows.
Is there an unspoken social contract between language committee and language users that aliasing a variable or causing a circular reference should not shoot your dog and burn down the house? That's the fundamental disagreement between Java and C's standards bodies.
which speaks how rare they are
I also suggest you say 5 years instead of "half-a-decade", most of us see through that and it's off-putting.
I have seen two instances of rooted memory:
- WPF. The implicit GC root path introduced by events. We were easily able to track this down due to the information that the GC holds in memory[1] (fixing it was not so easy).
- A leak in managed C++ (non-pure, i.e. native code). We had to use the normal tools to track this down, not a 5 minute diagnosis.
At the end of the day GC'd languages can have (and usually do) richer tooling surrounding memory usage. They are better in this regard even during a failure state.
[1]: https://learn.microsoft.com/en-us/dotnet/core/diagnostics/so...
Getting rid of C won't get rid of security problems anymore than moving to java and .net got rid of needing to think about memory leaks.
Those that think otherwise are ignorant of history, or choosing to ignore it.
And it gets worse when you consider resource exhaustion, not just memory. There are entire mechanisms in .net and java whose sole purpose in life is to try and deal with resource exhaustion because the GC only deals with 1 aspect of that resource exhaustion (memory leaks).
---
For those of us who watched that transition, it's obvious it won't work out the way people are claiming.
> it could slightly reduce
Had to wait on a patch for .net... not a problem anymore today, although I don't know the details how they solved the problem.
I think you mean "memory safety", not "correctness".
Correctness is a much harder target to hit and requires a good deal of time.
Moreover, almost no bugs are discovered in the actual reasonable software we have. That's not because we are the best engineers, or because we write it with the utmost care and attention to detail. It's because we're a total of 5 people (mostly a couple of years out of uni) looking at it. C, and other systems programming languages are greatly overrepresented in the corpus of software that is actually being combed through for bugs. Java and Cobol are heavily underrepresented.
I want to make this clear again. I work in banking. If 2008 showed us anything it's that banking underpins most of our modern society so these quality issues are not unimportant, they can be devastating.
What people do believe is it would remove whole classes of security problems that affect everybody. Even if you have software running in excel macros. Maybe in your environment that is a minority of your problems. That is probably not a good thing, and we feel for you, and respect preferring to tackle that problem first. But it would be a good idea to not entrench C further while you are doing that. Once you shrink your attack surface, it would be great if the code being invoked doesn't have exploitable memory overflows to make all your hard work pointless.
And that's all working as designed. Someone built it like that. There's no bug anywhere in that chain, just as extremely rickety system with no affordances for human intervention. No separation of what is trusted and what is not.
There's a good case to be made for using better languages than C and C++ for large classes of software. Don't weaken it by making absurd claims.
And this idea can be applied to so many things.
Seriously, very often things have enough downsides that you don't need to exaggerate things that are not downsides. You're actually weakening your side by doing so because if people cannot trust even that bit of honesty, why would they trust anything you say?
be trustworthy is the first rule in convincing others.