Browse Source

Copy name in LoadDictionary if not dictionary_name

compiledict.c sets dict_name to dictionary_name if dict_name is
not set, and passes that to LoadDictionary. LoadDictionary then
copies the passed in name to dictionary_name.

This causes -fsanitize=address to fail with overlapping memory
addresses passed to strncpy (copying the string to itself). As
such, don't copy the name in this case.
master
Reece H. Dunn 7 years ago
parent
commit
b60d2452c3
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      src/libespeak-ng/dictionary.c

+ 2
- 1
src/libespeak-ng/dictionary.c View File

int size; int size;
char fname[sizeof(path_home)+20]; char fname[sizeof(path_home)+20];


strncpy(dictionary_name, name, 40); // currently loaded dictionary name
if (dictionary_name != name)
strncpy(dictionary_name, name, 40); // currently loaded dictionary name
strncpy(tr->dictionary_name, name, 40); strncpy(tr->dictionary_name, name, 40);


// Load a pronunciation data file into memory // Load a pronunciation data file into memory

Loading…
Cancel
Save