From f9e80841dd79c4ede35cbaa2ffa52234b141922f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 25 Jul 2019 20:26:22 +0200 Subject: [PATCH] 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(). --- src/unix/sound_sdl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/sound_sdl.cpp b/src/unix/sound_sdl.cpp index 288f5f7bce..dd251284a1 100644 --- a/src/unix/sound_sdl.cpp +++ b/src/unix/sound_sdl.cpp @@ -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());