Re:Making C Less Dangerous in the Linux Kernel [video]
by aboutruby on Sunday January 27, 2019 @12:58AM
(#19010533)
The speaker mentions it, seems like the return value is different: https://i.imgur.com/Jj2fMZu.png
[ Parent
| on HN ]
Re:Making C Less Dangerous in the Linux Kernel [video]
by Taniwha on Sunday January 27, 2019 @06:10PM
(#19014343)
yes - 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)