i2r_address() doesn't handle the all-zeros IPv6 address correctly
(prints ":" when should print "::").

Trivial fix, to be applied to both 0.9.8 branch and HEAD, please.

--- crypto/x509v3/v3_addr.c.~1~ 2008-10-14 16:00:15.000000000 -0400
+++ crypto/x509v3/v3_addr.c     2008-11-11 18:26:02.000000000 -0500
@@ -183,20 +183,22 @@
     BIO_printf(out, "%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]);
     break;
   case IANA_AFI_IPV6:
     addr_expand(addr, bs, 16, fill);
     for (n = 16; n > 1 && addr[n-1] == 0x00 && addr[n-2] == 0x00; n -= 2)
       ;
     for (i = 0; i < n; i += 2)
       BIO_printf(out, "%x%s", (addr[i] << 8) | addr[i+1], (i < 14 ? ":" : ""));
     if (i < 16)
       BIO_puts(out, ":");
+    if (i == 0)
+      BIO_puts(out, ":");
     break;
   default:
     for (i = 0; i < bs->length; i++)
       BIO_printf(out, "%s%02x", (i > 0 ? ":" : ""), bs->data[i]);
     BIO_printf(out, "[%d]", (int) (bs->flags & 7));
     break;
   }
   return 1;
 }

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to