aboutsummaryrefslogtreecommitdiffstats
path: root/lib/vsprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r--lib/vsprintf.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index dfd60192bc2e..c11205688fb4 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -898,7 +898,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
898 case 'U': 898 case 'U':
899 return uuid_string(buf, end, ptr, spec, fmt); 899 return uuid_string(buf, end, ptr, spec, fmt);
900 case 'V': 900 case 'V':
901 return buf + vsnprintf(buf, end - buf, 901 return buf + vsnprintf(buf, end > buf ? end - buf : 0,
902 ((struct va_format *)ptr)->fmt, 902 ((struct va_format *)ptr)->fmt,
903 *(((struct va_format *)ptr)->va)); 903 *(((struct va_format *)ptr)->va));
904 case 'K': 904 case 'K':
@@ -1161,8 +1161,7 @@ qualifier:
1161 * return is greater than or equal to @size, the resulting 1161 * return is greater than or equal to @size, the resulting
1162 * string is truncated. 1162 * string is truncated.
1163 * 1163 *
1164 * Call this function if you are already dealing with a va_list. 1164 * If you're not already dealing with a va_list consider using snprintf().
1165 * You probably want snprintf() instead.
1166 */ 1165 */
1167int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) 1166int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
1168{ 1167{
@@ -1336,8 +1335,7 @@ EXPORT_SYMBOL(vsnprintf);
1336 * the @buf not including the trailing '\0'. If @size is == 0 the function 1335 * the @buf not including the trailing '\0'. If @size is == 0 the function
1337 * returns 0. 1336 * returns 0.
1338 * 1337 *
1339 * Call this function if you are already dealing with a va_list. 1338 * If you're not already dealing with a va_list consider using scnprintf().
1340 * You probably want scnprintf() instead.
1341 * 1339 *
1342 * See the vsnprintf() documentation for format string extensions over C99. 1340 * See the vsnprintf() documentation for format string extensions over C99.
1343 */ 1341 */
@@ -1416,8 +1414,7 @@ EXPORT_SYMBOL(scnprintf);
1416 * into @buf. Use vsnprintf() or vscnprintf() in order to avoid 1414 * into @buf. Use vsnprintf() or vscnprintf() in order to avoid
1417 * buffer overflows. 1415 * buffer overflows.
1418 * 1416 *
1419 * Call this function if you are already dealing with a va_list. 1417 * If you're not already dealing with a va_list consider using sprintf().
1420 * You probably want sprintf() instead.
1421 * 1418 *
1422 * See the vsnprintf() documentation for format string extensions over C99. 1419 * See the vsnprintf() documentation for format string extensions over C99.
1423 */ 1420 */