Use safe wxStrlcpy() instead of strncpy()

This probably doesn't change much in practice, as it's unlikely that
SDL_GetCurrentAudioDriver() returns a 255 character long stting, but is
still safer and avoid gcc 8 warnings about passing exactly the buffer
size to strncpy().
This commit is contained in:
Vadim Zeitlin
2019-07-25 20:26:22 +02:00
parent b717d0c8d5
commit f9e80841dd

View File

@@ -215,7 +215,7 @@ bool wxSoundBackendSDL::OpenAudio()
#if SDL_MAJOR_VERSION == 1
SDL_AudioDriverName(driver, 256);
#elif SDL_MAJOR_VERSION > 1
strncpy(driver, SDL_GetCurrentAudioDriver(), 256);
wxStrlcpy(driver, SDL_GetCurrentAudioDriver(), 256);
#endif
wxLogTrace(wxT("sound"), wxT("opened audio, driver '%s'"),
wxString(driver, wxConvLocal).c_str());