diff --git a/mozilla/netwerk/dns/src/nsIDNService.cpp b/mozilla/netwerk/dns/src/nsIDNService.cpp index 7f9ad7f6420..9b23cd03f5a 100644 --- a/mozilla/netwerk/dns/src/nsIDNService.cpp +++ b/mozilla/netwerk/dns/src/nsIDNService.cpp @@ -47,6 +47,7 @@ #include "punycode.h" //----------------------------------------------------------------------------- +// RFC 1034 - 3.1. Name space specifications and terminology static const PRUint32 kMaxDNSNodeLen = 63; //----------------------------------------------------------------------------- @@ -363,7 +364,7 @@ nsresult nsIDNService::stringPrepAndACE(const nsAString& in, nsACString& out) out.Truncate(); - if (in.Length() >= kMaxDNSNodeLen) { + if (in.Length() > kMaxDNSNodeLen) { NS_ERROR("IDN node too large"); return NS_ERROR_FAILURE; } @@ -377,6 +378,11 @@ nsresult nsIDNService::stringPrepAndACE(const nsAString& in, nsACString& out) rv = encodeToACE(strPrep, out); } + if (out.Length() > kMaxDNSNodeLen) { + NS_ERROR("IDN node too large"); + return NS_ERROR_FAILURE; + } + return rv; }