Add safety move for TLD lookup string

git-svn-id: https://cld2.googlecode.com/svn/trunk@71 b252ecd4-b096-bf77-eb8e-91563289f87e
This commit is contained in:
dsites@google.com
2013-08-24 19:04:15 +00:00
parent b57812d2c0
commit 5afb32e97e

View File

@@ -1448,6 +1448,8 @@ void SetCLDTLDHint(const char* tld, CLDLangPriors* langpriors) {
if (len > 3) {return;} // Ignore if more than three letters
char local_tld[4];
strncpy(local_tld, tld, len);
local_tld[3] = '\0'; // Safety move
// Lowercase
for (int i = 0; i < len; ++i) {local_tld[i] |= 0x20;}
const TLDLookup* entry = DoTLDLookup(local_tld,
kCLDTLDHintTable,