Browse Source

Don't copy filepath to buf. [coverity]

No modification was being done to buf after the copy of filepath.
It was just being passed to fopen. As such the copy is redundant,
and can lead to buffer overflow issues if the specified filepath
is larger than buf.
master
Reece H. Dunn 7 years ago
parent
commit
768957e0fc
1 changed files with 2 additions and 3 deletions
  1. 2
    3
      src/libespeak-ng/compilembrola.c

+ 2
- 3
src/libespeak-ng/compilembrola.c View File

@@ -86,9 +86,8 @@ espeak_ng_STATUS espeak_ng_CompileMbrolaVoice(const char *filepath, FILE *log, e
int mbrola_ctrl = 20; // volume in 1/16 ths
MBROLA_TAB data[N_PHONEME_TAB];

strcpy(buf, filepath);
if ((f_in = fopen(buf, "r")) == NULL)
return create_file_error_context(context, errno, buf);
if ((f_in = fopen(filepath, "r")) == NULL)
return create_file_error_context(context, errno, filepath);

while (fgets(buf, sizeof(phoneme), f_in) != NULL) {
buf[sizeof(phoneme)-1] = 0;

Loading…
Cancel
Save