提交 cb77067f 编写于 作者: S Stefan Weil

Fix CID 1164710 (Copy into fixed size buffer)

As null_script never changes, it is not necessary to allocate it in
each class instance. Change this, too.
Signed-off-by: NStefan Weil <sw@weilnetz.de>
上级 d3f6382b
......@@ -83,6 +83,8 @@ const char* UNICHARSET::kSpecialUnicharCodes[SPECIAL_UNICHAR_CODES_COUNT] = {
"|Broken|0|1"
};
const char* UNICHARSET::null_script = "NULL";
UNICHARSET::UNICHAR_PROPERTIES::UNICHAR_PROPERTIES() {
Init();
}
......@@ -175,8 +177,7 @@ UNICHARSET::UNICHARSET() :
size_used(0),
size_reserved(0),
script_table(nullptr),
script_table_size_used(0),
null_script("NULL") {
script_table_size_used(0) {
clear();
for (int i = 0; i < SPECIAL_UNICHAR_CODES_COUNT; ++i) {
unichar_insert(kSpecialUnicharCodes[i]);
......@@ -803,7 +804,7 @@ bool UNICHARSET::load_via_fgets(
unsigned int properties;
char script[64];
strcpy(script, null_script);
strncpy(script, null_script, sizeof(script));
int min_bottom = 0;
int max_bottom = UINT8_MAX;
int min_top = 0;
......
......@@ -1006,6 +1006,7 @@ class UNICHARSET {
// The substitutions clean up text that should exists for rendering of
// synthetic data, but not in the recognition set.
static const char* kCleanupMaps[][2];
static const char* null_script;
UNICHAR_SLOT* unichars;
UNICHARMAP ids;
......@@ -1014,7 +1015,6 @@ class UNICHARSET {
char** script_table;
int script_table_size_used;
int script_table_size_reserved;
const char* null_script;
// True if the unichars have their tops/bottoms set.
bool top_bottom_set_;
// True if the unicharset has significant upper/lower case chars.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册