From: Nikos Mavrogiannopoulos Date: Sun, 19 Dec 2010 12:08:47 +0000 (+0100) Subject: Use snprintf() to print IPs. There was a check just before that, but be safe, just... X-Git-Tag: gnutls_2_11_7~101 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=572888e8dfa8eb5a7fa951c4e577887bfe97b250;p=thirdparty%2Fgnutls.git Use snprintf() to print IPs. There was a check just before that, but be safe, just in case. --- diff --git a/lib/x509/output.c b/lib/x509/output.c index 8583f15065..a3e62f24a7 100644 --- a/lib/x509/output.c +++ b/lib/x509/output.c @@ -121,10 +121,10 @@ ip_to_string (void *_ip, int ip_size, char *string, int string_size) switch (ip_size) { case 4: - sprintf (string, "%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]); + snprintf (string, string_size, "%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]); break; case 16: - sprintf (string, "%x:%x:%x:%x:%x:%x:%x:%x", + snprintf (string, string_size, "%x:%x:%x:%x:%x:%x:%x:%x", (ip[0] << 8) | ip[1], (ip[2] << 8) | ip[3], (ip[4] << 8) | ip[5], (ip[6] << 8) | ip[7], (ip[8] << 8) | ip[9], (ip[10] << 8) | ip[11],