Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit e68bcfa

Browse files
committed
[Bug 16929] Copied strings are now null-terminated
1 parent 0ccd2bb commit e68bcfa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

revspeech/src/osxspeech.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ bool OSXSpeechNarrator::ListVoices(NarratorGender p_gender, NarratorListVoicesCa
136136
if ((t_gender != -1) && (myInfo.gender != t_gender)) continue;
137137
char cvoice[256];
138138
strncpy(cvoice, (const char*)&myInfo.name[1], myInfo.name[0]);
139+
// PM-2016-02-15: [[ Bug 16929 ]] Make sure the copied strings are null-terminated
140+
cvoice[myInfo.name[0]]='\0';
139141
p_callback(p_context, p_gender, cvoice);
140142
}
141143
}
@@ -292,6 +294,8 @@ void OSXSpeechNarrator::FindAndSelect()
292294
VoiceDescription myInfo;
293295
if (GetVoiceDescription(&tVoice, &myInfo, sizeof(myInfo)) == noErr) {
294296
strncpy(cvoice, (const char*)&myInfo.name[1], myInfo.name[0]);
297+
// PM-2016-02-15: [[ Bug 16929 ]] Make sure the copied strings are null-terminated
298+
cvoice[myInfo.name[0]]='\0';
295299
if (strcmp(cvoice,speechvoice) == 0)
296300
{
297301
FoundVoice = &tVoice;

0 commit comments

Comments
 (0)