diff options
author | nelson%bolyard.com <devnull@localhost> | 2008-10-24 02:34:44 +0000 |
---|---|---|
committer | nelson%bolyard.com <devnull@localhost> | 2008-10-24 02:34:44 +0000 |
commit | 62487cba74e5a998fb90104f3339f10d8428c9ad (patch) | |
tree | 8a7719181256185b00cae96e793f8b73bd486368 | |
parent | 5b3a5306e6865edc9468e265b1810bb0fb4958ea (diff) | |
download | nss-hg-62487cba74e5a998fb90104f3339f10d8428c9ad.tar.gz |
Bug 421634: Don't send an SNI Client Hello extension bearing an IPv6 address
r=julien.pierre,wtc
-rw-r--r-- | security/nss/lib/ssl/ssl3ecc.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/security/nss/lib/ssl/ssl3ecc.c b/security/nss/lib/ssl/ssl3ecc.c index d404d4f9a..015240018 100644 --- a/security/nss/lib/ssl/ssl3ecc.c +++ b/security/nss/lib/ssl/ssl3ecc.c @@ -1190,17 +1190,18 @@ ssl3_SendServerNameIndicationExtension( 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 */ + /* 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 */ |