From 5afb32e97e111f4e2f1f434fdc76feeaf5755946 Mon Sep 17 00:00:00 2001 From: "dsites@google.com" Date: Sat, 24 Aug 2013 19:04:15 +0000 Subject: [PATCH] Add safety move for TLD lookup string git-svn-id: https://cld2.googlecode.com/svn/trunk@71 b252ecd4-b096-bf77-eb8e-91563289f87e --- internal/compact_lang_det_hint_code.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/compact_lang_det_hint_code.cc b/internal/compact_lang_det_hint_code.cc index fc1f0ae..6c352e7 100644 --- a/internal/compact_lang_det_hint_code.cc +++ b/internal/compact_lang_det_hint_code.cc @@ -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,