diff options
author | Johannes Schickel | 2010-05-05 17:54:12 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-05-05 17:54:12 +0000 |
commit | caf31ee5afb61a88342176473bf77ebddc098ca4 (patch) | |
tree | bc0ec2794958a722d314af38c00d65a9a058b0cf /backends/midi | |
parent | 7da8c8949b56835cf87f88ffd6cfb8204c711592 (diff) | |
download | scummvm-rg350-caf31ee5afb61a88342176473bf77ebddc098ca4.tar.gz scummvm-rg350-caf31ee5afb61a88342176473bf77ebddc098ca4.tar.bz2 scummvm-rg350-caf31ee5afb61a88342176473bf77ebddc098ca4.zip |
Replace various strncpy usages by strlcpy.
svn-id: r48955
Diffstat (limited to 'backends/midi')
-rw-r--r-- | backends/midi/timidity.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp index 36d437414f..1a44e62b16 100644 --- a/backends/midi/timidity.cpp +++ b/backends/midi/timidity.cpp @@ -38,6 +38,7 @@ #include "common/util.h" #include "common/endian.h" +#include "common/str.h" #include "sound/musicplugin.h" #include "sound/mpu401.h" @@ -154,11 +155,9 @@ int MidiDriver_TIMIDITY::open() { /* get server hostname; if not specified in env, use default */ if ((res = getenv("TIMIDITY_HOST")) == NULL) - strncpy(timidity_host, DEFAULT_TIMIDITY_HOST, MAXHOSTNAMELEN); + Common::strlcpy(timidity_host, DEFAULT_TIMIDITY_HOST, sizeof(timidity_host)); else - strncpy(timidity_host, res, sizeof(timidity_host)); - - timidity_host[sizeof(timidity_host) - 1] = '\0'; + Common::strlcpy(timidity_host, res, sizeof(timidity_host)); /* extract control port */ if ((res = strrchr(timidity_host, ':')) != NULL) { |