From 172499bfd0a2edd43d2390dbe47dd3937eb021b1 Mon Sep 17 00:00:00 2001 From: "nelson%bolyard.com" Date: Mon, 6 Oct 2008 22:04:15 +0000 Subject: [PATCH] Bug 421634: Don't send an SNI Client Hello extension bearing an IPv6 address r=wtc,julien.pierre git-svn-id: svn://10.0.0.236/trunk@254543 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/security/nss/lib/ssl/ssl3ext.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/mozilla/security/nss/lib/ssl/ssl3ext.c b/mozilla/security/nss/lib/ssl/ssl3ext.c index ddc60643ae3..d5ce9677cc0 100644 --- a/mozilla/security/nss/lib/ssl/ssl3ext.c +++ b/mozilla/security/nss/lib/ssl/ssl3ext.c @@ -41,7 +41,7 @@ * ***** END LICENSE BLOCK ***** */ /* TLS extension code moved here from ssl3ecc.c */ -/* $Id: ssl3ext.c,v 1.2 2008-03-06 20:16:22 wtc%google.com Exp $ */ +/* $Id: ssl3ext.c,v 1.3 2008-10-06 22:04:15 nelson%bolyard.com Exp $ */ #include "nssrenam.h" #include "nss.h" @@ -291,17 +291,18 @@ ssl3_SendServerNameXtn( PRBool append, PRUint32 maxBytes) { - PRUint32 len, span; + PRUint32 len; + PRNetAddr netAddr; + /* must have a hostname */ if (!ss || !ss->url || !ss->url[0]) return 0; - /* must have at lest one character other than [0-9\.] */ - len = PORT_Strlen(ss->url); - span = strspn(ss->url, "0123456789."); - if (len == span) { - /* is a dotted decimal IP address */ - return 0; + /* must not be an IPv4 or IPv6 address */ + if (PR_SUCCESS == PR_StringToNetAddr(ss->url, &netAddr)) { + /* is an IP address (v4 or v6) */ + return 0; } + len = PORT_Strlen(ss->url); if (append && maxBytes >= len + 9) { SECStatus rv; /* extension_type */