2 ms·
May I ask what's wrong with malloc? I don't have much experience with C outside of embedded systems, so my security practices in C are probably less than ideal
by toomanybeersies 10y ago
May I ask what's wrong with malloc?
I don't have much experience with C outside of embedded systems, so my security practices in C are probably less than ideal for PC/server based code.
- tptacek 10y agoNothing is wrong with malloc per se, but the way it's used here is extraordinarily unsafe (they're allocating fixed-sized buffers for variable-length fields). Even if they'd attempted to allocate variable-length buffers, they'd still need to handle integers safely, and this code doesn't.