Replace uses of sprintf(3) with snprintf(3).

At -00, the compiler warns about sprintf(3), and it is promoted to an
error by -Werror.

Change-Id: Ibb380d27d7eb09dda8ac785be2478d656b379190
diff --git a/libc/dns/nameser/ns_ttl.c b/libc/dns/nameser/ns_ttl.c
index 2395b99..de073b8 100644
--- a/libc/dns/nameser/ns_ttl.c
+++ b/libc/dns/nameser/ns_ttl.c
@@ -36,12 +36,6 @@
 #include <stdio.h>
 #include <string.h>
 
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) ((size_t)sprintf x)
-#endif
-
 /* Forward. */
 
 static int	fmt1(int t, char s, char **buf, size_t *buflen);
@@ -157,8 +151,8 @@
 	char tmp[50];
 	size_t len;
 
-	len = SPRINTF((tmp, "%d%c", t, s));
-	if (len + 1 > *buflen)
+	len = (size_t)snprintf(tmp, sizeof(tmp), "%d%c", t, s);
+	if ((int)len < 0 || len + 1 > *buflen)
 		return (-1);
 	strcpy(*buf, tmp);
 	*buf += len;