diff --git a/src/common/audio/sound/s_sound.cpp b/src/common/audio/sound/s_sound.cpp index f2195f890f..852d389f5a 100644 --- a/src/common/audio/sound/s_sound.cpp +++ b/src/common/audio/sound/s_sound.cpp @@ -749,9 +749,8 @@ sfxinfo_t *SoundEngine::LoadSound(sfxinfo_t *sfx) { auto sfxp = sfxdata.data(); int32_t dmxlen = LittleLong(((int32_t *)sfxp)[1]); - // If the sound is voc, use the custom loader. - if (memcmp (sfxp, "Creative Voice File", 19) == 0) + if (size > 19 && memcmp (sfxp, "Creative Voice File", 19) == 0) { sfx->data = GSnd->LoadSoundVoc(sfxp, size); } diff --git a/src/gamedata/keysections.cpp b/src/gamedata/keysections.cpp index b1d3354ca2..bcde05eddd 100644 --- a/src/gamedata/keysections.cpp +++ b/src/gamedata/keysections.cpp @@ -171,7 +171,7 @@ void D_LoadWadSettings () while (conf < eof) { - size_t i; + size_t i = 0; // Fetch a line to execute command.Clear(); @@ -179,14 +179,14 @@ void D_LoadWadSettings () { command.Push(conf[i]); } - if (i == 0) + if (i == 0) // Blank line { conf++; continue; } command.Push(0); conf += i; - if (*conf == '\n') + if (conf >= eof || *conf == '\n') { conf++; }