From caf31ee5afb61a88342176473bf77ebddc098ca4 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 5 May 2010 17:54:12 +0000 Subject: Replace various strncpy usages by strlcpy. svn-id: r48955 --- sound/softsynth/mt32/synth.cpp | 5 +++-- sound/softsynth/mt32/tables.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'sound/softsynth') diff --git a/sound/softsynth/mt32/synth.cpp b/sound/softsynth/mt32/synth.cpp index b3f8d81719..6a16db22ec 100644 --- a/sound/softsynth/mt32/synth.cpp +++ b/sound/softsynth/mt32/synth.cpp @@ -25,6 +25,8 @@ #include "mt32emu.h" +#include "common/str.h" + #if defined(MACOSX) || defined(SOLARIS) || defined(__MINGW32__) // Older versions of Mac OS X didn't supply a powf function, so using it // will cause a binary incompatibility when trying to run a binary built @@ -345,8 +347,7 @@ bool Synth::initRhythmTimbre(int timbreNum, const Bit8u *mem, unsigned int memLe memcpy(&timbre->common, mem, 14); unsigned int memPos = 14; char drumname[11]; - strncpy(drumname, timbre->common.name, 10); - drumname[10] = 0; + Common::strlcpy(drumname, timbre->common.name, 11); for (int t = 0; t < 4; t++) { if (((timbre->common.pmute >> t) & 0x1) == 0x1) { if (memPos + 58 >= memLen) { diff --git a/sound/softsynth/mt32/tables.cpp b/sound/softsynth/mt32/tables.cpp index 571750ee99..b0414154dc 100644 --- a/sound/softsynth/mt32/tables.cpp +++ b/sound/softsynth/mt32/tables.cpp @@ -614,7 +614,7 @@ bool Tables::initNotes(Synth *synth, PCMWaveEntry *pcmWaves, float rate, float m File *file = NULL; char header[20]; - strncpy(header, "MT32WAVE", 8); + memcpy(header, "MT32WAVE", 8); int pos = 8; // Version... for (int i = 0; i < 4; i++) -- cgit v1.2.3