Skip to content

Commit 2e44874

Browse files
tobluxpmladek
authored andcommitted
lib/vsprintf: Improve vsprintf + sprintf function comments
Clarify that the return values of vsprintf() and sprintf() exclude the trailing NUL character. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Petr Mladek <pmladek@suse.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20251103090913.2066-2-thorsten.blum@linux.dev Signed-off-by: Petr Mladek <pmladek@suse.com>
1 parent 67e1b00 commit 2e44874

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/vsprintf.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3054,8 +3054,8 @@ EXPORT_SYMBOL(scnprintf);
30543054
* @fmt: The format string to use
30553055
* @args: Arguments for the format string
30563056
*
3057-
* The function returns the number of characters written
3058-
* into @buf. Use vsnprintf() or vscnprintf() in order to avoid
3057+
* The return value is the number of characters written into @buf not including
3058+
* the trailing '\0'. Use vsnprintf() or vscnprintf() in order to avoid
30593059
* buffer overflows.
30603060
*
30613061
* If you're not already dealing with a va_list consider using sprintf().
@@ -3074,8 +3074,8 @@ EXPORT_SYMBOL(vsprintf);
30743074
* @fmt: The format string to use
30753075
* @...: Arguments for the format string
30763076
*
3077-
* The function returns the number of characters written
3078-
* into @buf. Use snprintf() or scnprintf() in order to avoid
3077+
* The return value is the number of characters written into @buf not including
3078+
* the trailing '\0'. Use snprintf() or scnprintf() in order to avoid
30793079
* buffer overflows.
30803080
*
30813081
* See the vsnprintf() documentation for format string extensions over C99.

0 commit comments

Comments
 (0)