mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-12-02 06:42:10 +00:00
Use strcpy instead of memcpy+strlen.
This replaces uses of: memcpy(dst, src, strlen(src)) with: strcpy(dst, src) This fixes issues with reading past the end of the copied buffer (e.g. when processing word-based replacements for emoji characters) by ensuring that the destination buffer is null terminated. Reported by Michael Curran <mick@nvaccess.org>
This commit is contained in:
@@ -2394,7 +2394,7 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
match1.end_type |= p - p_start;
|
||||
}
|
||||
strcpy(end_phonemes, match1.phonemes);
|
||||
memcpy(p_start, word_copy, strlen(word_copy));
|
||||
strcpy(p_start, word_copy);
|
||||
return match1.end_type;
|
||||
}
|
||||
}
|
||||
@@ -2404,7 +2404,7 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(p_start, word_copy, strlen(word_copy));
|
||||
strcpy(p_start, word_copy);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user