Apply length check for generated ACE string,

bug 198637, r=shanjian, sr=darin.


git-svn-id: svn://10.0.0.236/trunk@140274 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
nhotta%netscape.com
2003-03-25 20:48:03 +00:00
parent 0ace7bd025
commit 407872aa95

View File

@@ -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;
}