4 ms·
Totally unsafe. It also allows %n. If possible use a proper format library, or at the least the _s variant.
by rurban 6y ago
Totally unsafe. It also allows %n.
If possible use a proper format library, or at the least the _s variant.
- TazeTSchnitzel 6y ago> Totally unsafe. Please justify that claim. snprintf() limits itself to the specified buffer size (in the way safe from off-by-one errors) and always null-terminates. What more do you want?
- TazeTSchnitzel 6y ago(Ah, sorry, if it's about format strings, I know they're potentially dangerous. I think they're fine in practice though so long as you have compiler warnings for type mismatches and non-literal strings turned on.)