News for hackers. Stuff that matters.
Re:The Two Factions of C++ by AlotOfReading on Monday November 25, 2024 @05:36PM (#42240851)
The way C and C++ are standardized, you can't rely on the correct functioning of anything in the presence of undefined behavior, including memory unsafety. For what it's worth, I also opened a random file in the OpenZiti C SDK and immediately found safety issues like this: https://github.com/openziti/ziti-tunnel-sdk-c/blob/9993f61e6...

That's why this topic is such a big deal. Even people who really should know better like the OpenZiti authors aren't able to reliably write safe code.

Re:The Two Factions of C++ by drivebyhooting on Tuesday November 26, 2024 @12:43AM (#42242896)
Why is that a safety issue?
Re:The Two Factions of C++ by AlotOfReading on Tuesday November 26, 2024 @01:45AM (#42243067)
Malloc/Calloc can fail even if they typically don't on most Linux systems. You should always check for null pointers before accessing the resulting buffer, which doesn't happen here. The connections() block is also never explicitly freed anywhere I was able to find in a quick search. That's allowed, but definitely bad practice.