[svn-commits] mattf: branch mattf/zaptel-1.2-vpmadt032fwupdate r3945 - in /team/mattf/zapte...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 5 16:28:00 CST 2008


Author: mattf
Date: Wed Mar  5 16:27:59 2008
New Revision: 3945

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3945
Log:
Merged revisions 3831,3833,3837,3847,3917 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r3831 | kpfleming | 2008-02-15 14:23:27 -0600 (Fri, 15 Feb 2008) | 2 lines

update README to reflect currently supported Digium interface cards

........
r3833 | jpeeler | 2008-02-15 17:33:44 -0600 (Fri, 15 Feb 2008) | 1 line

Fixes bug 11471. Replaced all instances of strncpy with zap_copy_string (added to zaptel.h) to fix any off by one errors and ensure destination string is NULL terminated.
........
r3837 | tzafrir | 2008-02-16 08:13:27 -0600 (Sat, 16 Feb 2008) | 3 lines

* Start documenting module parameters in the README.
* Update the hardware supported by xpp.

........
r3847 | jpeeler | 2008-02-18 16:49:30 -0600 (Mon, 18 Feb 2008) | 1 line

added some forgotten includes for zap_copy_string
........
r3917 | tzafrir | 2008-03-03 14:44:01 -0600 (Mon, 03 Mar 2008) | 4 lines

No need for userspace 'make clean' here. Kbuild takes care of it.

Closes issue #12118 .

........

Modified:
    team/mattf/zaptel-1.2-vpmadt032fwupdate/   (props changed)
    team/mattf/zaptel-1.2-vpmadt032fwupdate/Makefile
    team/mattf/zaptel-1.2-vpmadt032fwupdate/README
    team/mattf/zaptel-1.2-vpmadt032fwupdate/fxotune.c
    team/mattf/zaptel-1.2-vpmadt032fwupdate/jpah.h
    team/mattf/zaptel-1.2-vpmadt032fwupdate/ppp/zaptel.c
    team/mattf/zaptel-1.2-vpmadt032fwupdate/sethdlc-new.c
    team/mattf/zaptel-1.2-vpmadt032fwupdate/sethdlc.c
    team/mattf/zaptel-1.2-vpmadt032fwupdate/tonezone.c
    team/mattf/zaptel-1.2-vpmadt032fwupdate/tor2ee.c
    team/mattf/zaptel-1.2-vpmadt032fwupdate/wct4xxp/wct4xxp-diag.c
    team/mattf/zaptel-1.2-vpmadt032fwupdate/zaptel-base.c
    team/mattf/zaptel-1.2-vpmadt032fwupdate/zaptel.h
    team/mattf/zaptel-1.2-vpmadt032fwupdate/ztcfg-dude.c
    team/mattf/zaptel-1.2-vpmadt032fwupdate/ztcfg.c
    team/mattf/zaptel-1.2-vpmadt032fwupdate/ztd-eth.c
    team/mattf/zaptel-1.2-vpmadt032fwupdate/ztdynamic.c
    team/mattf/zaptel-1.2-vpmadt032fwupdate/ztmonitor.c
    team/mattf/zaptel-1.2-vpmadt032fwupdate/zttranscode.c

Propchange: team/mattf/zaptel-1.2-vpmadt032fwupdate/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Mar  5 16:27:59 2008
@@ -1,1 +1,1 @@
-/branches/1.2:1-3826
+/branches/1.2:1-3944

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/Makefile
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/Makefile?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/Makefile (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/Makefile Wed Mar  5 16:27:59 2008
@@ -554,7 +554,6 @@
 	$(MAKE) -C $(KSRC) SUBDIRS=$(PWD) clean
 	$(MAKE) -C wct4xxp clean
 	$(MAKE) -C wctc4xxp clean
-	$(MAKE) -C wcte12xp clean
 	$(MAKE) -C wctdm24xxp clean
 	rm -rf .tmp_versions
 	rm -f gendigits tones.h

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/README
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/README?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/README (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/README Wed Mar  5 16:27:59 2008
@@ -9,14 +9,20 @@
 ------------------
 Digital Cards
 ~~~~~~~~~~~~~
-- wct4xxp: 
-  * Digium newer quad-span T1/E1/J1 cards: Wildcard TE420P/TE410P/TE405P 
-  * Digium newer dual-span T1/E1/J1 cards: Wildcard TE220P/TE210P/TE205P 
-- wcte12xp: Digium Wildcard TE120P and the TE122P single-span T1/E1/J1 card
-- wcte11xp: Digium Wildcard TE110P T1/E1/J1
+- wct4xxp:
+  * Digium TE205P/TE207P/TE210P/TE212P: PCI dual-port T1/E1/J1
+  * Digium TE405P/TE407P/TE410P/TE412P: PCI quad-port T1/E1/J1
+  * Digium TE220: PCI-Express dual-port T1/E1/J1
+  * Digium TE420: PCI-Express quad-port T1/E1/J1
+- wcte12xp:
+  * Digium TE120P: PCI single-port T1/E1/J1
+  * Digium TE121: PCI-Express single-port T1/E1/J1
+  * Digium TE122: PCI single-port T1/E1/J1
+- wcte11xp:
+  * Digium TE110P: PCI single-port T1/E1/J1
 - wct1xxp: 
-  * Wildcard T100P (old single-span T1)
-  * Wildcard E100P (old single-span E1)
+  * Digium T100P: PCI single-port T1
+  * Digium E100P: PCI single-port E1
 - tor2: Tormenta quad-span T1/E1 card from the Zapata Telephony project
 - torisa: The old dual-span ISA T1 card from Zapata Telephony
 
@@ -24,11 +30,13 @@
 Analog Cards
 ~~~~~~~~~~~~
 - wctdm24xxp: 
-  * Digium TDM2400P card: up to 24 analog ports
-  * Digium TDM800P card: up to 8 analog ports
-- wctdm: Digium TDM400P card: up to 4 analog ports
+  * Digium TDM2400P/AEX2400: up to 24 analog ports
+  * Digium TDM800P/AEX800: up to 8 analog ports
+  * Digium TDM410: up to 4 analog ports
+- wctdm:
+  * Digium TDM400P: up to 4 analog ports
 - xpp: Xorcom Astribank: a USB connected unit of up to 32 ports
-  (also BRI)
+  (includeing the digital BRI and E1/T1 modules)
 - wcfxo: X100P, similar and clones. A simple single-port FXO card
 - wcusb: Digium S100U: A simple single-port USB FXS unit
 
@@ -257,6 +265,82 @@
 Currently that file must set "TELEPHONY=yes" for the zaptel init.d to
 work.
 
+Module Parameters
+~~~~~~~~~~~~~~~~~
+The kernel modules can be configured through module parameters. Module
+parameters can optionally be set at load time. They are normally set (if
+needed) by a line in a file under /etc/modprobe.d/ or in the file
+/etc/modprobe.conf (Or /etc/modules.conf in kernel 2.4).
+
+Example line:
+
+  options zaptel debug=1
+
+The module parameters can normally be modified at runtime through sysfs:
+
+  pungenday:~# cat /sys/module/zaptel/parameters/debug 
+  0
+  pungenday:~# echo 1 >/sys/module/zaptel/parameters/debug
+  pungenday:~# cat /sys/module/zaptel/parameters/debug 
+  1
+
+Viewing and setting parameters that way is possible as of kernel 2.6 .
+In kernels older than 2.6.10, the sysfs "files" for the parameters
+reside directly under /sys/module/'module_name' .
+
+Useful module parameters:
+
+debug (most modules)::
+  Sets debug mode / debug level. With most modules 'debug' can be either
+  disabled (0, the default value) or enabled (any other value). 
+  +
+  +
+  wctdm and wcte1xp print several extra debugging messages if the value
+  of debug is more than 1.
+  +
+  +
+  Some modules have "debugging flags" bits - the value of debug is a
+  bitmask and several messages are printed if some bits are set:
+  - ztdummy:
+    * 1: DEBUG_GENERAL - general error messages.
+    * 2: DEBUG_TICKS - Show that the module is alive :-)
+  - wctdm24xxp:
+    * 1: DEBUG_CARD
+    * 2: DEBUG_ECHOCAN
+  - wct4xxp:
+    * 1: DEBUG_MAIN
+    * 2: DEBUG_DTMF
+    * 4: DEBUG_REGS
+    * 8: DEBUG_TSI
+    * 16: DEBUG_ECHOCAN
+    * 32: DEBUG_RBS
+    * 64: DEBUG_FRAMER
+  +
+  +
+  The xpp modules use 'print_dbg' instead of 'debug' . Refer to
+  README.Astribank.
+
+deftaps (zaptel)::
+  The default size for the echo canceller. The number is in "taps", that
+  is "samples", 1/8 ms. The default is 64 - for a tail size of 8 ms.
+  +
+  +
+  Asterisk's chan_zap tends to pass its own value anyway, with a
+  different default size. So normally setting this doesn't change
+  anything.
+
+To get a list of parameters supported by a module, use 
+
+  modinfo module_name
+
+Or, for a module you have just built:
+
+  modinfo ./module_name.ko
+
+For the xpp modules this will also include the description and default
+value of the module. You can find a list of useful xpp module parameters
+in README.Astribank .
+
 
 Zaptel PERL modules
 -------------------

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/fxotune.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/fxotune.c?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/fxotune.c (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/fxotune.c Wed Mar  5 16:27:59 2008
@@ -167,7 +167,7 @@
 	memset(&dop, 0, sizeof(dop));
 	dop.op = ZT_DIAL_OP_REPLACE;
 	dop.dialstr[0] = 'T';
-	strncpy(dop.dialstr + 1, info->dialstr, sizeof(dop.dialstr) - 1);
+	zap_copy_string(dop.dialstr + 1, info->dialstr, sizeof(dop.dialstr));
 
 	if (ioctl(info->device, ZT_DIAL, &dop)) {
 		fprintf(stderr, "Unable to dial!\n");

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/jpah.h
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/jpah.h?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/jpah.h (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/jpah.h Wed Mar  5 16:27:59 2008
@@ -32,6 +32,7 @@
 #define MALLOC(a) malloc(a)
 #define FREE(a) free(a)
 #endif
+#include "zaptel.h"
 
 /* Echo canceller definition */
 struct echo_can_state {
@@ -49,7 +50,7 @@
 
 static void echo_can_identify(char *buf, size_t len)
 {
-	strncpy(buf, "JP1", len);
+	zap_copy_string(buf, "JP1", len);
 }
 
 static void echo_can_shutdown(void)

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/ppp/zaptel.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/ppp/zaptel.c?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/ppp/zaptel.c (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/ppp/zaptel.c Wed Mar  5 16:27:59 2008
@@ -223,7 +223,7 @@
 	}
     }
 
-    strncpy(devnam, cp, sizeof(devnam) - 1);
+    zap_copy_string(devnam, cp, sizeof(devnam));
 
     info("Using zaptel device '%s'\n", devnam);
 

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/sethdlc-new.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/sethdlc-new.c?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/sethdlc-new.c (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/sethdlc-new.c Wed Mar  5 16:27:59 2008
@@ -22,6 +22,7 @@
 #include <sys/socket.h>
 #include <linux/if.h>
 #include <linux/sockios.h>
+#include "zaptel.h"
 
 #if GENERIC_HDLC_VERSION != 4
 #error Generic HDLC layer version mismatch, please get correct sethdlc.c
@@ -673,7 +674,7 @@
 	if (sock < 0)
 		error("Unable to create socket: %s\n", strerror(errno));
   
-	strncpy(req.ifr_name, argv[1], sizeof(req.ifr_name) - 1); /* Device name */
+	zap_copy_string(req.ifr_name, argv[1], sizeof(req.ifr_name)); /* Device name */
 
 	if (argc == 2)
 		show_port();

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/sethdlc.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/sethdlc.c?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/sethdlc.c (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/sethdlc.c Wed Mar  5 16:27:59 2008
@@ -10,6 +10,7 @@
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <linux/if.h>
+#include "zaptel.h"
 
 
 struct ifreq req;		/* for ioctl */
@@ -293,7 +294,7 @@
 	if (sock<0)
 		error("Unable to create socket: %s\n", strerror(errno));
   
-	strncpy(req.ifr_name, argv[1], sizeof(req.ifr_name) - 1); /* Device name */
+	zap_copy_string(req.ifr_name, argv[1], sizeof(req.ifr_name)); /* Device name */
 
 	if (argc == 2) {
 		show_port(sock);

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/tonezone.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/tonezone.c?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/tonezone.c (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/tonezone.c Wed Mar  5 16:27:59 2008
@@ -30,6 +30,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include "tonezone.h"
+#include "zaptel.h"
 
 #define DEFAULT_ZT_DEV "/dev/zap/ctl"
 
@@ -274,7 +275,7 @@
 	}
 	h->count = count;
 	h->zone = z->zone;
-	strncpy(h->name, z->description, sizeof(h->name));
+	zap_copy_string(h->name, z->description, sizeof(h->name));
 	x = z->zone;
 	ioctl(fd, ZT_FREEZONE, &x);
 	res = ioctl(fd, ZT_LOADZONE, h);

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/tor2ee.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/tor2ee.c?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/tor2ee.c (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/tor2ee.c Wed Mar  5 16:27:59 2008
@@ -37,6 +37,7 @@
 #include <netinet/in.h>
 #include <linux/ppp_defs.h>
 #include <time.h>
+#include "zaptel.h"
 
 #define NEED_PCI_IDS
 #include "tor2-hw.h"
@@ -779,7 +780,7 @@
 
 	/* Store revision number */
 	memset(ee->revision, 0, sizeof(ee->revision));
-	strncpy(ee->revision, revision, sizeof(ee->revision));
+	zap_copy_string(ee->revision, revision, sizeof(ee->revision));
 
 	/* Calculate FCS on revision and data */
 	ee->crc16 = htons(calc_crc16((char *)ee, sizeof(*ee) - 2));
@@ -1051,7 +1052,7 @@
 			exit(1);
 		}
 		modify(&ee, reg, val);
-		strncpy(tmp, ee.revision, sizeof(tmp));
+		zap_copy_string(tmp, ee.revision, sizeof(tmp));
 		if (write_eeprom_file(writefile, tmp, &ee)) {
 			fprintf(stderr, "Unable to write EEPROM file\n");
 			closemem();

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/wct4xxp/wct4xxp-diag.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/wct4xxp/wct4xxp-diag.c?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/wct4xxp/wct4xxp-diag.c (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/wct4xxp/wct4xxp-diag.c Wed Mar  5 16:27:59 2008
@@ -378,7 +378,7 @@
 		exit(1);
 	}
 	if (*(argv[1]) == '/')
-		strncpy(fn, argv[1], sizeof(fn) - 1);
+		zap_copy_string(fn, argv[1], sizeof(fn));
 	else
 		snprintf(fn, sizeof(fn), "/dev/zap/%d", atoi(argv[1]));
 	fd = open(fn, O_RDWR);

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/zaptel-base.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/zaptel-base.c?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/zaptel-base.c (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/zaptel-base.c Wed Mar  5 16:27:59 2008
@@ -1212,7 +1212,7 @@
 	/* Set up the path of the file/link itself */
 	tmp_offset = devfs_generate_path(zaptel_devfs_dir, tmp, sizeof(tmp) - 1);
 	sprintf(buf, "/%d", chan->channo);
-	strncpy(path, tmp+tmp_offset, sizeof(path) - 1);
+	zap_copy_string(path, tmp+tmp_offset, sizeof(path));
 	strncat(path, buf, sizeof(path) - 1);
 
 	err = devfs_mk_symlink(NULL, path, DEVFS_FL_DEFAULT, link+link_offset, &chan->fhandle_symlink, NULL);
@@ -2514,7 +2514,7 @@
 	memset(slab, 0, size);
 	/* Grab the zone */
 	z = (struct zt_zone *)slab;
-	strncpy(z->name, th.name, sizeof(z->name) - 1);
+	zap_copy_string(z->name, th.name, sizeof(z->name));
 	for (x=0;x<ZT_MAX_CADENCE;x++)
 		z->ringcadence[x] = th.ringcadence[x];
 	data += sizeof(struct zt_tone_def_header);
@@ -2928,7 +2928,7 @@
 		stack.param.pulseaftertime = chan->pulseaftertime;
 		if (chan->span) stack.param.spanno = chan->span->spanno;
 			else stack.param.spanno = 0;
-		strncpy(stack.param.name, chan->name, sizeof(stack.param.name) - 1);
+		zap_copy_string(stack.param.name, chan->name, sizeof(stack.param.name));
 		stack.param.chanpos = chan->chanpos;
 		/* Return current law */
 		if (chan->xlaw == __zt_alaw)
@@ -3037,8 +3037,8 @@
 		stack.span.spanno = i; /* put the span # in here */
 		stack.span.totalspans = 0;
 		if (maxspans) stack.span.totalspans = maxspans - 1; /* put total number of spans here */
-		strncpy(stack.span.desc, spans[i]->desc, sizeof(stack.span.desc) - 1);
-		strncpy(stack.span.name, spans[i]->name, sizeof(stack.span.name) - 1);
+		zap_copy_string(stack.span.desc, spans[i]->desc, sizeof(stack.span.desc));
+		zap_copy_string(stack.span.name, spans[i]->name, sizeof(stack.span.name));
 		stack.span.alarms = spans[i]->alarms;		/* get alarm status */
 		stack.span.bpvcount = spans[i]->bpvcount;	/* get BPV count */
 		stack.span.rxlevel = spans[i]->rxlevel;	/* get rx level */
@@ -3577,7 +3577,7 @@
 				rv = -EBUSY;
 				break;
 			   }
-			strncpy(chan->txdialbuf + strlen(chan->txdialbuf), stack.tdo.dialstr, ZT_MAX_DTMF_BUF - strlen(chan->txdialbuf));
+			zap_copy_string(chan->txdialbuf + strlen(chan->txdialbuf), stack.tdo.dialstr, ZT_MAX_DTMF_BUF - strlen(chan->txdialbuf));
 			if (!chan->dialing)
 			   {
 				chan->dialing = 1;

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/zaptel.h
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/zaptel.h?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/zaptel.h (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/zaptel.h Wed Mar  5 16:27:59 2008
@@ -1733,4 +1733,30 @@
 /*! Maximum audio mask */
 #define ZT_FORMAT_AUDIO_MASK	((1 << 16) - 1)
 
+/*!
+	\brief Size-limited null-terminating string copy.
+	\param dst The destination buffer
+	\param src The source string
+	\param size The size of the destination buffer
+	\return Nothing.
+
+	This is similar to \a strncpy, with two important differences:
+	- the destination buffer will \b always be null-terminated
+	- the destination buffer is not filled with zeros past the copied string length
+	These differences make it slightly more efficient, and safer to use since it will
+	not leave the destination buffer unterminated. There is no need to pass an artificially
+	reduced buffer size to this function (unlike \a strncpy), and the buffer does not need
+	to be initialized to zeroes prior to calling this function.
+*/
+static inline void zap_copy_string(char *dst, const char *src, unsigned int size)
+{
+	while (*src && size) {
+		*dst++ = *src++;
+		size--;
+	}
+	if (__builtin_expect(!size, 0))
+		dst--;
+	*dst = '\0';
+}
+
 #endif /* _LINUX_ZAPTEL_H */

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/ztcfg-dude.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/ztcfg-dude.c?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/ztcfg-dude.c (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/ztcfg-dude.c Wed Mar  5 16:27:59 2008
@@ -182,8 +182,8 @@
 	}
 
 
-	strncpy(zds[numdynamic].driver, realargs[0], sizeof(zds[numdynamic].driver));
-	strncpy(zds[numdynamic].addr, realargs[1], sizeof(zds[numdynamic].addr));
+	zap_copy_string(zds[numdynamic].driver, realargs[0], sizeof(zds[numdynamic].driver));
+	zap_copy_string(zds[numdynamic].addr, realargs[1], sizeof(zds[numdynamic].addr));
 	zds[numdynamic].numchans = chans;
 	zds[numdynamic].timing = timing;
 	
@@ -291,7 +291,7 @@
 	for (x=0;x<res;x++) {
 		if (strchr(args[x], '-')) {
 			/* It's a range */
-			strncpy(argcopy, args[x], sizeof(argcopy));
+			zap_copy_string(argcopy, args[x], sizeof(argcopy));
 			res2 = parseargs(argcopy, range, 2, '-');
 			if (res2 != 2) {
 				error("Syntax error in range '%s'.  Should be <val1>-<val2>.\n", args[x]);
@@ -566,7 +566,7 @@
 		error("Too many tone zones specified\n");
 		return 0;
 	}
-	strncpy(zonestoload[numzones++], args, sizeof(zonestoload[0]));
+	zap_copy_string(zonestoload[numzones++], args, sizeof(zonestoload[0]));
 	return 0;
 }
 

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/ztcfg.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/ztcfg.c?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/ztcfg.c (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/ztcfg.c Wed Mar  5 16:27:59 2008
@@ -256,8 +256,8 @@
 	}
 
 
-	strncpy(zds[numdynamic].driver, realargs[0], sizeof(zds[numdynamic].driver));
-	strncpy(zds[numdynamic].addr, realargs[1], sizeof(zds[numdynamic].addr));
+	zap_copy_string(zds[numdynamic].driver, realargs[0], sizeof(zds[numdynamic].driver));
+	zap_copy_string(zds[numdynamic].addr, realargs[1], sizeof(zds[numdynamic].addr));
 	zds[numdynamic].numchans = chans;
 	zds[numdynamic].timing = timing;
 	
@@ -365,7 +365,7 @@
 	for (x=0;x<res;x++) {
 		if (strchr(args[x], '-')) {
 			/* It's a range */
-			strncpy(argcopy, args[x], sizeof(argcopy));
+			zap_copy_string(argcopy, args[x], sizeof(argcopy));
 			res2 = parseargs(argcopy, range, 2, '-');
 			if (res2 != 2) {
 				error("Syntax error in range '%s'.  Should be <val1>-<val2>.\n", args[x]);
@@ -612,7 +612,7 @@
 		error("Too many tone zones specified\n");
 		return 0;
 	}
-	strncpy(zonestoload[numzones++], args, sizeof(zonestoload[0]));
+	zap_copy_string(zonestoload[numzones++], args, sizeof(zonestoload[0]));
 	return 0;
 }
 
@@ -868,7 +868,7 @@
 	for (x=0;x<res;x++) {
 		if (strchr(args[x], '-')) {
 			/* It's a range */
-			strncpy(argcopy, args[x], sizeof(argcopy));
+			zap_copy_string(argcopy, args[x], sizeof(argcopy));
 			res2 = parseargs(argcopy, range, 2, '-');
 			if (res2 != 2) {
 				error("Syntax error in range '%s'.  Should be <val1>-<val2>.\n", args[x]);

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/ztd-eth.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/ztd-eth.c?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/ztd-eth.c (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/ztd-eth.c Wed Mar  5 16:27:59 2008
@@ -297,12 +297,12 @@
 		memset(z, 0, sizeof(struct ztdeth));
 
 		/* Address should be <dev>/<macaddr>[/subaddr] */
-		strncpy(tmp, addr, sizeof(tmp) - 1);
+		zap_copy_string(tmp, addr, sizeof(tmp));
 		tmp2 = strchr(tmp, '/');
 		if (tmp2) {
 			*tmp2 = '\0';
 			tmp2++;
-			strncpy(z->ethdev, tmp, sizeof(z->ethdev) - 1);
+			zap_copy_string(z->ethdev, tmp, sizeof(z->ethdev));
 		} else {
 			printk("Invalid TDMoE address (no device) '%s'\n", addr);
 			kfree(z);

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/ztdynamic.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/ztdynamic.c?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/ztdynamic.c (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/ztdynamic.c Wed Mar  5 16:27:59 2008
@@ -579,8 +579,8 @@
 	memset(z->msgbuf, 0, bufsize);
 
 	/* Setup parameters properly assuming we're going to be okay. */
-	strncpy(z->dname, zds->driver, sizeof(z->dname) - 1);
-	strncpy(z->addr, zds->addr, sizeof(z->addr) - 1);
+	zap_copy_string(z->dname, zds->driver, sizeof(z->dname));
+	zap_copy_string(z->addr, zds->addr, sizeof(z->addr));
 	z->timing = zds->timing;
 	sprintf(z->span.name, "ZTD/%s/%s", zds->driver, zds->addr);
 	sprintf(z->span.desc, "Dynamic '%s' span at '%s'", zds->driver, zds->addr);

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/ztmonitor.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/ztmonitor.c?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/ztmonitor.c (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/ztmonitor.c Wed Mar  5 16:27:59 2008
@@ -155,10 +155,10 @@
 	memset(bar+barlen+2, '>', 1);
 	memset(bar+barlen+3, '\0', 1);
 
-	strncpy(bar+(barlen/2), "(RX)", 4);
+	zap_copy_string(bar+(barlen/2), "(RX)", 4);
 	printf("%s", bar);
 
-	strncpy(bar+(barlen/2), "(TX)", 4);
+	zap_copy_string(bar+(barlen/2), "(TX)", 4);
 	printf(" %s\n", bar);
 }
 

Modified: team/mattf/zaptel-1.2-vpmadt032fwupdate/zttranscode.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.2-vpmadt032fwupdate/zttranscode.c?view=diff&rev=3945&r1=3944&r2=3945
==============================================================================
--- team/mattf/zaptel-1.2-vpmadt032fwupdate/zttranscode.c (original)
+++ team/mattf/zaptel-1.2-vpmadt032fwupdate/zttranscode.c Wed Mar  5 16:27:59 2008
@@ -311,7 +311,7 @@
 	if (!tc)
 		return -ENOSYS;
 
-	strncpy(info.name, tc->name, sizeof(info.name) - 1);
+	zap_copy_string(info.name, tc->name, sizeof(info.name));
 	info.numchannels = tc->numchannels;
 	info.srcfmts = tc->srcfmts;
 	info.dstfmts = tc->dstfmts;




More information about the svn-commits mailing list