Skip to content

Commit

Permalink
- Exhumed: handle unterminated strings in LoadSound without reading b…
Browse files Browse the repository at this point in the history
…eyond their end.
  • Loading branch information
coelckers committed Jan 30, 2022
1 parent dcb8768 commit d500550
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions source/games/exhumed/src/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,12 @@ TArray<uint8_t> EXSoundEngine::ReadSound(int lumpnum)

int LoadSound(const char* name)
{
FString nname(name, 8);
int sndid = soundEngine->FindSoundNoHash(nname.GetChars());
char nname[9]{};
for (int i = 0; i < 8 && name[i]; i++) nname[i] = name[i];
int sndid = soundEngine->FindSoundNoHash(nname);
if (sndid > 0) return sndid - 1;

FStringf filename("%s.voc", nname.GetChars());
FStringf filename("%s.voc", nname);
auto lump = S_LookupSound(filename);
if (lump > 0)
{
Expand Down

0 comments on commit d500550

Please sign in to comment.