News for hackers. Stuff that matters.
Re:Some simple tricks in C/C++ by beagle3 on Wednesday May 06, 2020 @11:49AM (#23092398)
The #define new has a , instead of multiplication. It will compile likely without warning, but cause buffer overflow.

says “use sprintf”, which you shouldn’t do because ... buffer overflow (it’s possible to avoid but you need to really know what you are doing and set a maximum length for any conversion, which article authors does not do). For the same use cases, Proper use of snprintf would avoid overflows.

Other advice seems ok to me.

Re:Some simple tricks in C/C++ by sherincall on Wednesday May 06, 2020 @11:58AM (#23092521)
There are several instances of bad syntax in the article. Easy to make mistakes if you don't write C daily. I assume they meant to use calloc() here instead of malloc().