diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-12-28 15:13:48 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-12-28 15:13:48 +0000 |
commit | 5fe71f624f6d440c61910233b73740cc0bc18507 (patch) | |
tree | 3afc40d41a8b05dd64045b85e168a36d6502a577 /channels/misdn_config.c | |
parent | a16fe9bcce9590ae10e87af301abd6486696db1f (diff) |
Use strncat() instead of an sprintf() in which source and target buffers overlap
http://lists.digium.com/pipermail/asterisk-dev/2008-December/035919.html
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@166772 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/misdn_config.c')
-rw-r--r-- | channels/misdn_config.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/channels/misdn_config.c b/channels/misdn_config.c index 5125058ea..0924ad983 100644 --- a/channels/misdn_config.c +++ b/channels/misdn_config.c @@ -794,8 +794,9 @@ void misdn_cfg_get_config_string (int port, enum misdn_cfg_elements elem, char* else iter = port_cfg[0][place].ml; if (iter) { - for (; iter; iter = iter->next) - sprintf(tempbuf, "%s%s, ", tempbuf, iter->msn); + for (; iter; iter = iter->next) { + strncat(tempbuf, iter->msn, sizeof(tempbuf) - strlen(tempbuf) - 1); + } tempbuf[strlen(tempbuf)-2] = 0; } snprintf(buf, bufsize, " -> msns: %s", *tempbuf ? tempbuf : "none"); |