I noticed in GENERAL_NAME_print() code the following parsing code which has
a bug.
When my test certificate's subjectAltName has "IP Address: 2001::21"
[expanded out v6 style of course], then the code below ends up printing
“::21” instead of “2001::21”.
Isn’t this a parsing bug? Not that when I use inet_ntop(AF_INET6, p, ....)
it all works fine and I get "2001::21".
case GEN_IPADD:
p = gen->d.ip->data;
if(gen->d.ip->length == 4)
BIO_snprintf(oline, sizeof oline,
"%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
* else if(gen->d.ip->length == 16)** -------> **IPv6*
{
oline[0] = 0;
for (i = 0; i < 8; i++)
{
BIO_snprintf(htmp, sizeof htmp,
*"%X", p[0] << 8 | p[1]*);
p += 2;
strcat(oline, htmp);
if (i != 7)
strcat(oline, ":");
}
}
Thanks,
Vineet