Make strcpy calls in load dictionary copy at most 40 bytes so clang __strcpy_check does not get triggered (possible buffer overflow?)

This commit is contained in:
Rui Batista
2016-10-05 13:15:48 +01:00
parent bc3b027e51
commit 7b82e39793
+2 -2
View File
@@ -210,8 +210,8 @@ int LoadDictionary(Translator *tr, const char *name, int no_error)
unsigned int size;
char fname[sizeof(path_home)+20];
strcpy(dictionary_name, name); // currently loaded dictionary name
strcpy(tr->dictionary_name, name);
strncpy(dictionary_name, name, 40); // currently loaded dictionary name
strncpy(tr->dictionary_name, name, 40);
// Load a pronunciation data file into memory
// bytes 0-3: offset to rules data