4 ms·
The userspace version is snprintf.
by chacham15 8y ago
The userspace version is snprintf.
- aboutruby 8y agoThe speaker mentions it, seems like the return value is different: https://i.imgur.com/Jj2fMZu.png https://i.imgur.com/Jj2fMZu.png
- Taniwha 8y agoyes - snprintf() returns the length of the string that would be written even if it wasn't clipped to the length of the output buffer - if you want to accumulate strings into a buffer using the output length to update the offset/size bad things will happen. scnprintf() returns the actual number of bytes written (less the null)
- technion 8y agoThere's a great write up here on how assuming scnprintf behaved like snprintf led to memory bugs: http://blog.infosectcbr.com.au/2018/11/memory-bugs-in-multiple-linux-kernel.html http://blog.infosectcbr.com.au/2018/11/memory-bugs-in-multip...
- kzrdude 8y agoThe C standard's snprintf is not like scnprintf.