Null-terminate strings

This commit is contained in:
Kevin Caccamo 2017-07-31 08:27:02 -04:00 committed by Rachael Alexanderson
parent ff35620a09
commit a4370a3529

View file

@ -564,6 +564,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity ()
int curSpace = spaceIdx, i = 1;
TimidityArgs[0] = new char[TimidityExe.Len() + 1];
TimidityArgs[0][TimidityExe.Len()] = 0;
strcpy(TimidityArgs[0], TimidityExe.GetChars());
int argLen;
@ -578,6 +579,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity ()
argLen = CommandLine.Len() - curSpace;
}
TimidityArgs[i] = new char[argLen];
TimidityArgs[i][argLen-1] = 0;
strcpy(TimidityArgs[i], CommandLine.Mid(spaceIdx, curSpace - spaceIdx).GetChars());
i += 1;
}