mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-07 07:21:10 +00:00
- Exhumed: handle unterminated strings in LoadSound without reading beyond their end.
This commit is contained in:
parent
f98765ce95
commit
12b25df582
1 changed files with 4 additions and 3 deletions
|
@ -181,11 +181,12 @@ TArray<uint8_t> EXSoundEngine::ReadSound(int lumpnum)
|
||||||
|
|
||||||
int LoadSound(const char* name)
|
int LoadSound(const char* name)
|
||||||
{
|
{
|
||||||
FString nname(name, 8);
|
char nname[9]{};
|
||||||
int sndid = soundEngine->FindSoundNoHash(nname.GetChars());
|
for (int i = 0; i < 8 && name[i]; i++) nname[i] = name[i];
|
||||||
|
int sndid = soundEngine->FindSoundNoHash(nname);
|
||||||
if (sndid > 0) return sndid - 1;
|
if (sndid > 0) return sndid - 1;
|
||||||
|
|
||||||
FStringf filename("%s.voc", nname.GetChars());
|
FStringf filename("%s.voc", nname);
|
||||||
auto lump = S_LookupSound(filename);
|
auto lump = S_LookupSound(filename);
|
||||||
if (lump > 0)
|
if (lump > 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue