r/cpp • • Jan 16 '13

Are the Java vulnerabilities actually C and C++ vulnerabilities?

http://isocpp.org/blog/2013/01/are-the-java-vulnerabilities-actually-c-and-c-vulnerabilities
1 Upvotes

12 comments sorted by

28

u/calum8991 Jan 16 '13

The crucial difference between C, C++ and Java is that C and C++ are unsafe languages. Any undefined behaviour in C or C++ is therefore the fault of the code, not the fault in C and C++. (Unless there are compiler or standards bugs but I've never seen these exploited.)

Java does however claim to be a safe language, so therefore any flaws are in its implementation.

4

u/eric_niebler Jan 16 '13

Short version, for those too lazy to RTFA: this vulnerability, no; others, yes. Security is hard, regardless of the language you use. Get off yer high horse and review some code.

32

u/[deleted] Jan 16 '13

Some other exploits have indeed used vulnerabilities in Java’s native C code implementation

I don't know if that's as simple as "other vulnerabilities are actually C vulnerabilities," it sounds to me more like "other vulnerabilities were caused by bad C code."

C will let you shoot yourself in the foot with a nuclear warhead but I don't think it's fair to call a Java VM bug (which is what that snippet sounds like) a "C vulnerability." Perhaps I'm misunderstanding

3

u/nahguri Jan 16 '13

"C vulnerability."

I hear you. Since C/C++ are not managed languages, there are no C/C++ vulnerabilities. Sure, there may be vulnerabilities in your code but they are caused by your bad coding, not C/C++ itself.

1

u/m42a Jan 18 '13

Untrue. If you did string s; cin >> str; and it caused a buffer overflow, that would be a C++ vulnerability. It wouldn't be caused by your bad coding.

-7

u/pjmlp Jan 16 '13

It is a C vulnerability because they make use of the typical C errors of buffer overruns and dangling pointers.

They mostly relate to code exposed via native methods.

11

u/Xetick Jan 16 '13

By that logic all C / C++ vulnerabilities are machine code vulnerabilities and not the fault of C / C++. Great, then I don't have to take the blame for my own coding bugs. I'll just blame the machine code.

8

u/ZMeson Embedded Developer Jan 16 '13

Answer from the article itself:

The answer is no, these particular exploits are pure Java. Some other exploits have indeed used vulnerabilities in Java’s native C code implementation, but the major vulnerabilities in the news lately are in Java itself.

21

u/btown_brony Jan 16 '13

Pure, shameful linkbait.

16

u/repsilat Jan 16 '13

Betteridge's Law of Headlines:

Any headline which ends in a question mark can be answered by the word no.

7

u/[deleted] Jan 16 '13

Yeah, because the ISO wouldn't have any readers if they didn't bait Reddit. /s

2

u/elperroborrachotoo Jan 16 '13

Frankly, if it was for visits, they'd posted a Java kitten in a major subreddit.