]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Use snprintf() to print IPs. There was a check just before that, but be safe, just...
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 19 Dec 2010 12:08:47 +0000 (13:08 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 19 Dec 2010 12:08:47 +0000 (13:08 +0100)
lib/x509/output.c

index 8583f1506542ca9a51b24cc9de8ef8ed602a6758..a3e62f24a71e8eb049e6f47a59c836cbc70b389e 100644 (file)
@@ -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],