Initializing soundEntry and using something safer than strcpy

This commit is contained in:
Anthony
2015-02-05 11:12:33 -08:00
parent ee0575bbb0
commit 3558418ed7
+4 -4
View File
@@ -357,9 +357,9 @@ void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChann
char buffer[PLATFORM_MAX_PATH];
strcpy(buffer, pSample);
char soundEntry[PLATFORM_MAX_PATH];
char soundEntry[PLATFORM_MAX_PATH] = "";
#if SOURCE_ENGINE >= SE_PORTAL2
strcpy(soundEntry, pSoundEntry);
Q_strncpy(soundEntry, pSoundEntry, sizeof(soundEntry));
#endif
#if SOURCE_ENGINE < SE_PORTAL2
@@ -493,9 +493,9 @@ void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChan
char buffer[PLATFORM_MAX_PATH];
strcpy(buffer, pSample);
char soundEntry[PLATFORM_MAX_PATH];
char soundEntry[PLATFORM_MAX_PATH] = "";
#if SOURCE_ENGINE >= SE_PORTAL2
strcpy(soundEntry, pSoundEntry);
Q_strncpy(soundEntry, pSoundEntry, sizeof(soundEntry));
#endif
#if SOURCE_ENGINE < SE_PORTAL2