You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RETURN VALUE
Upon successful return, these functions return the number of characters printed (excluding the null byte used to end output to strings).
The functions snprintf() and vsnprintf() do not write more than size bytes (including the terminating null byte ('\0')). If the output was truncated due to this limit, then the return value is the
number of characters (excluding the terminating null byte) which would have been written to the final string if enough space had been available. Thus, a return value of size or more means that the
output was truncated. (See also below under NOTES.)
If an output error is encountered, a negative value is returned.
So always returning 0 is not a standard behavior.
However fixing this perfectly will be difficult as it would need to determine the number of char that will overrun the buffer...
I guess a first step would be to:
Initially reported here: LedgerHQ/nanos-secure-sdk#28 by @shufps
Technically man
snprintf
says that:So always returning 0 is not a standard behavior.
However fixing this perfectly will be difficult as it would need to determine the number of char that will overrun the buffer...
I guess a first step would be to:
return (uint32_t) str - (uint32_t) op_str;
as proposed here snprintf always return 0 nanos-secure-sdk#28 (comment) when the buffer size is enough.size
when the output was truncated.The text was updated successfully, but these errors were encountered: