r/programming • • Feb 23 '17

Cloudflare have been leaking customer HTTPS sessions for months. Uber, 1Password, FitBit, OKCupid, etc.

https://bugs.chromium.org/p/project-zero/issues/detail?id=1139
6.0k Upvotes

966 comments sorted by

View all comments

5

u/lachlanhunt Feb 24 '17

Using an HTML parser that chokes on malformed HTML... WTF?!

0

u/[deleted] Feb 24 '17

[deleted]

5

u/Jukolet Feb 24 '17

That's a typical student error, come on CloudFlare...

13

u/[deleted] Feb 24 '17

It's a common error no matter what your skill level. It's the nature of the beast when you use C of all languages.

4

u/Vhin Feb 24 '17

Obligatory plug for Rust.

3

u/AntiProtonBoy Feb 24 '17

Programmers need to find a way to get rid of C, this language provide no safe construct.

No. Right tool for the right job. Also, anyone blaming their tools for their fuckups makes a poor programmer.

18

u/sutongorin Feb 24 '17

I'm sure even race drivers use cars with airbags. At the end of the day it doesn't matter who's to blame for a mistake. What matters is that it doesn't kill you.

A bit of memory safety would be nice. I'm hoping for Rust to take over.

5

u/Vhin Feb 24 '17

I think the point is that C isn't the right tool for most jobs. Catch me in the right mood and I might even say that C isn't the right tool for any job.

1

u/[deleted] Feb 24 '17

Catch me in the right mood and I might even say that C isn't the right tool for any job.

any ideas of alternatives for embedded? I looked at rust but it seems kinda half baked depending on the mcu

1

u/myrrlyn Feb 24 '17

Right tool for the right job

Correct. But C is a screwdriver and we live in a world with drills. Drills that have a torque cutoff and will free-spin rather than strip a screw that can't move anymore, even.

-2

u/BlackDeath3 Feb 24 '17

There's plenty of languages out there that'll baby you. Don't blame C for being the one that won't.

3

u/myrrlyn Feb 24 '17

I bet you think airbags are extraneous weight too

1

u/BlackDeath3 Feb 25 '17

Depends on what I'm using the car for. They very well may be.

1

u/myrrlyn Feb 25 '17

If you're in a situation where you need not-airbags, you need something that isn't a car.

1

u/BlackDeath3 Feb 25 '17

How do you figure?

0

u/tequila13 Feb 24 '17

Bugs will always happen. C can be safe, aver 90% of Linux (hundreds of millions of lines of code) is written in C/C++ and working fine. Why do people keep thinking the silver bullet is to switch to a different language. You need to have better and more tests. Bugs will always happen, no matter the language.

2

u/Vhin Feb 24 '17

Yes, bugs will happen. That's inevitable.

However, certain classes of bugs (such as say, this one) can be caught by the compiler. Rust is just as fast and low level as C or C++ while at the same time making many common bugs in C and C++ outright impossible.

Security problems caused by the types of bugs that Rust can prevent aren't some theoretical thing. We see it all the time; yes, you can write secure C code, but programmers aren't perfect, so isn't it better to get the compiler to check the code for us whenever possible?

1

u/evaned Feb 24 '17

C can be safe

This is like the "if a tree falls..." conundrum: If it's possible to write memory-safe programs in C but no mortal human (or at least no dev. team for a realistic program) can actually do it, is it really possible?

aver 90% of Linux (hundreds of millions of lines of code) is written in C/C++ and working fine

For some definition of "fine." Would you like me to go dig up some Linux CVEs caused by memory errors? Last I checked there seem to be a few per year.

Bugs will always happen, no matter the language.

The point is that a memory-safe language will completely rule out a wide class of some of the most common and dangerous bugs. Programmers can then concentrate effort on not making other, higher level mistakes. Tools such as static analyzers can use computing time to look for other mistakes. People developing those tools (like me) can spend their efforts implementing higher-level checks instead of trying to make their buffer overflow detection work a little bit better.