[asterisk-commits] russell: branch 1.4 r166772 - /branches/1.4/channels/misdn_config.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Dec 28 09:13:48 CST 2008


Author: russell
Date: Sun Dec 28 09:13:48 2008
New Revision: 166772

URL: http://svn.digium.com/view/asterisk?view=rev&rev=166772
Log:
Use strncat() instead of an sprintf() in which source and target buffers overlap

http://lists.digium.com/pipermail/asterisk-dev/2008-December/035919.html

Modified:
    branches/1.4/channels/misdn_config.c

Modified: branches/1.4/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/misdn_config.c?view=diff&rev=166772&r1=166771&r2=166772
==============================================================================
--- branches/1.4/channels/misdn_config.c (original)
+++ branches/1.4/channels/misdn_config.c Sun Dec 28 09:13:48 2008
@@ -794,8 +794,9 @@
 			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");




More information about the asterisk-commits mailing list