]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Use strncat() instead of an sprintf() in which source and target buffers overlap
authorRussell Bryant <russell@russellbryant.com>
Sun, 28 Dec 2008 15:13:48 +0000 (15:13 +0000)
committerRussell Bryant <russell@russellbryant.com>
Sun, 28 Dec 2008 15:13:48 +0000 (15:13 +0000)
http://lists.digium.com/pipermail/asterisk-dev/2008-December/035919.html

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@166772 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/misdn_config.c

index 5125058ea0aa0e0a9c9418616fd4229a553fcc98..0924ad98376cf769399d5791e686522949f6eb2d 100644 (file)
@@ -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");