diff options
author | Jakob Schlyter <jakob@cvs.openbsd.org> | 2004-09-29 20:55:28 +0000 |
---|---|---|
committer | Jakob Schlyter <jakob@cvs.openbsd.org> | 2004-09-29 20:55:28 +0000 |
commit | d73d91884f17d7d1790ef1624f332a805adb80f5 (patch) | |
tree | e3e4ad86e4d35b6d1774a260642f147bf66f8130 /usr.sbin | |
parent | 468a6d76602051cf5d392b7e311a7250de66ded9 (diff) |
fix remaining sprintf
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bind/lib/lwres/print.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/usr.sbin/bind/lib/lwres/print.c b/usr.sbin/bind/lib/lwres/print.c index b686689170d..057fe0542d2 100644 --- a/usr.sbin/bind/lib/lwres/print.c +++ b/usr.sbin/bind/lib/lwres/print.c @@ -241,7 +241,7 @@ lwres__print_vsnprintf(char *str, size_t size, const char *format, va_list ap) { head = ""; tmpui = tmpi; } - sprintf(buf, "%llu", + snprintf(buf, sizeof(buf), "%llu", tmpui); goto printint; case 'o': @@ -252,8 +252,8 @@ lwres__print_vsnprintf(char *str, size_t size, const char *format, va_list ap) { tmpui = va_arg(ap, long int); else tmpui = va_arg(ap, int); - sprintf(buf, - alt ? "%#llo" : "%llo", tmpui); + snprintf(buf, sizeof(buf), + alt ? "%#llo" : "%llo", tmpui); goto printint; case 'u': if (q) @@ -263,7 +263,7 @@ lwres__print_vsnprintf(char *str, size_t size, const char *format, va_list ap) { tmpui = va_arg(ap, unsigned long int); else tmpui = va_arg(ap, unsigned int); - sprintf(buf, "%llu", tmpui); + snprintf(buf, sizeof(buf), "%llu", tmpui); goto printint; case 'x': if (q) @@ -278,7 +278,7 @@ lwres__print_vsnprintf(char *str, size_t size, const char *format, va_list ap) { if (precision > 2) precision -= 2; } - sprintf(buf, "%llx", tmpui); + snprintf(buf, sizeof(buf), "%llx", tmpui); goto printint; case 'X': if (q) @@ -293,7 +293,7 @@ lwres__print_vsnprintf(char *str, size_t size, const char *format, va_list ap) { if (precision > 2) precision -= 2; } - sprintf(buf, "%llX", tmpui); + snprintf(buf, sizeof(buf), "%llX", tmpui); goto printint; printint: if (precision != 0 || width != 0) { @@ -419,7 +419,7 @@ lwres__print_vsnprintf(char *str, size_t size, const char *format, va_list ap) { break; case 'p': v = va_arg(ap, void *); - sprintf(buf, "%p", v); + snprintf(buf, sizeof(buf), "%p", v); length = strlen(buf); if (precision > length) zeropad = precision - length; @@ -495,7 +495,8 @@ lwres__print_vsnprintf(char *str, size_t size, const char *format, va_list ap) { */ if (precision > 512) precision = 512; - sprintf(fmt, "%%%s%s.%lu%s%c", alt ? "#" : "", + snprintf(fmt, sizeof(fmt), + "%%%s%s.%lu%s%c", alt ? "#" : "", plus ? "+" : space ? " " : "", precision, l ? "L" : "", *format); switch (*format) { @@ -507,12 +508,12 @@ lwres__print_vsnprintf(char *str, size_t size, const char *format, va_list ap) { #ifdef HAVE_LONG_DOUBLE if (l) { ldbl = va_arg(ap, long double); - sprintf(buf, fmt, ldbl); + snprintf(buf, sizeof(buf), fmt, ldbl); } else #endif { dbl = va_arg(ap, double); - sprintf(buf, fmt, dbl); + snprintf(buf, sizeof(buf), fmt, dbl); } length = strlen(buf); if (width > 0) { |