summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tor2.c9
-rw-r--r--torisa.c4
-rw-r--r--wcfxo.c7
-rw-r--r--wct1xxp.c7
-rw-r--r--wct4xxp/base.c9
-rw-r--r--wctdm.c7
-rw-r--r--wctdm24xxp/base.c8
-rw-r--r--wcte11xp.c7
-rw-r--r--wcte12xp.c7
-rw-r--r--wcusb.c4
-rw-r--r--zaptel-base.c9
-rw-r--r--zaptel.h2
-rw-r--r--ztdummy.c4
13 files changed, 49 insertions, 35 deletions
diff --git a/tor2.c b/tor2.c
index e4874fb..e3350e6 100644
--- a/tor2.c
+++ b/tor2.c
@@ -270,10 +270,13 @@ static void init_spans(struct tor2 *tor)
int x, y, c;
for (x = 0; x < SPANS_PER_CARD; x++) {
sprintf(tor->spans[x].name, "Tor2/%d/%d", tor->num, x + 1);
- sprintf(tor->spans[x].desc, "Tormenta 2 (PCI) Quad %s Card %d Span %d", (tor->cardtype == TYPE_T1) ? "T1" : "E1", tor->num, x + 1);
+ snprintf(tor->spans[x].desc, sizeof(tor->spans[x].desc) - 1,
+ "Tormenta 2 (PCI) fQuad %s Card %d Span %d",
+ (tor->cardtype == TYPE_T1) ? "T1" : "E1", tor->num, x + 1);
tor->spans[x].manufacturer = "Digium";
- tor->spans[x].devicetype = tor->type;
- sprintf(tor->spans[x].location, "PCI Bus %02d Slot %02d", tor->pci->bus->number, PCI_SLOT(tor->pci->devfn) + 1);
+ strncpy(tor->spans[x].devicetype, tor->type, sizeof(tor->spans[x].devicetype) - 1);
+ snprintf(tor->spans[x].location, sizeof(tor->spans[x].location) - 1,
+ "PCI Bus %02d Slot %02d", tor->pci->bus->number, PCI_SLOT(tor->pci->devfn) + 1);
tor->spans[x].spanconfig = tor2_spanconfig;
tor->spans[x].chanconfig = tor2_chanconfig;
tor->spans[x].startup = tor2_startup;
diff --git a/torisa.c b/torisa.c
index c4fc42d..1fb0077 100644
--- a/torisa.c
+++ b/torisa.c
@@ -1079,9 +1079,9 @@ static int __init tor_init(void)
}
strcpy(spans[0].name, "TorISA/1");
- strcpy(spans[0].desc, "ISA Tormenta Span 1");
+ strncpy(spans[0].desc, "ISA Tormenta Span 1", sizeof(spans[0].desc) - 1);
spans[0].manufacturer = "Digium";
- spans[0].devicetype = "Tormenta ISA";
+ strncpy(spans[0].devicetype, "Tormenta ISA", sizeof(spans[0].devicetype) - 1);
spans[0].spanconfig = torisa_spanconfig;
spans[0].chanconfig = torisa_chanconfig;
spans[0].startup = torisa_startup;
diff --git a/wcfxo.c b/wcfxo.c
index 1dfd697..4ab8367 100644
--- a/wcfxo.c
+++ b/wcfxo.c
@@ -625,11 +625,12 @@ static int wcfxo_initialize(struct wcfxo *wc)
{
/* Zapata stuff */
sprintf(wc->span.name, "WCFXO/%d", wc->pos);
- sprintf(wc->span.desc, "%s Board %d", wc->variety, wc->pos + 1);
+ snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Board %d", wc->variety, wc->pos + 1);
sprintf(wc->chan.name, "WCFXO/%d/%d", wc->pos, 0);
- sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+ snprintf(wc->span.location, sizeof(wc->span.location) - 1,
+ "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
wc->span.manufacturer = "Digium";
- wc->span.devicetype = wc->variety;
+ strncpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype) - 1);
wc->chan.sigcap = ZT_SIG_FXSKS | ZT_SIG_FXSLS | ZT_SIG_SF;
wc->chan.chanpos = 1;
wc->span.chans = &wc->chan;
diff --git a/wct1xxp.c b/wct1xxp.c
index a54c511..5a439ad 100644
--- a/wct1xxp.c
+++ b/wct1xxp.c
@@ -761,10 +761,11 @@ static int t1xxp_software_init(struct t1xxp *wc)
return -1;
wc->num = x;
sprintf(wc->span.name, "WCT1/%d", wc->num);
- sprintf(wc->span.desc, "%s Card %d", wc->variety, wc->num);
+ snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Card %d", wc->variety, wc->num);
wc->span.manufacturer = "Digium";
- wc->span.devicetype = wc->variety;
- sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+ strncpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype) - 1);
+ snprintf(wc->span.location, sizeof(wc->span.location) - 1,
+ "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
wc->span.spanconfig = t1xxp_spanconfig;
wc->span.chanconfig = t1xxp_chanconfig;
wc->span.irq = wc->dev->irq;
diff --git a/wct4xxp/base.c b/wct4xxp/base.c
index 1b2207a..a06ecfa 100644
--- a/wct4xxp/base.c
+++ b/wct4xxp/base.c
@@ -1530,10 +1530,13 @@ static void init_spans(struct t4 *wc)
for (x = 0; x < wc->numspans; x++) {
ts = wc->tspans[x];
sprintf(ts->span.name, "TE%d/%d/%d", wc->numspans, wc->num, x + 1);
- sprintf(ts->span.desc, "T%dXXP (PCI) Card %d Span %d", wc->numspans, wc->num, x+1);
+ snprintf(ts->span.desc, sizeof(ts->span.desc) - 1,
+ "T%dXXP (PCI) Card %d Span %d", wc->numspans, wc->num, x+1);
ts->span.manufacturer = "Digium";
- ts->span.devicetype = wc->variety;
- sprintf(ts->span.location, "PCI%sBus %02d Slot %02d", ts->spanflags & FLAG_EXPRESS ? " Express" : " ", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+ strncpy(ts->span.devicetype, wc->variety, sizeof(ts->span.devicetype) - 1);
+ snprintf(ts->span.location, sizeof(ts->span.location) - 1,
+ "PCI%sBus %02d Slot %02d", ts->spanflags & FLAG_EXPRESS ? " Express" : " ",
+ wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
switch (ts->spantype) {
case TYPE_T1:
ts->span.spantype = "T1";
diff --git a/wctdm.c b/wctdm.c
index 4df3f82..30035c9 100644
--- a/wctdm.c
+++ b/wctdm.c
@@ -2022,10 +2022,11 @@ static int wctdm_initialize(struct wctdm *wc)
/* Zapata stuff */
sprintf(wc->span.name, "WCTDM/%d", wc->pos);
- sprintf(wc->span.desc, "%s Board %d", wc->variety, wc->pos + 1);
- sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+ snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Board %d", wc->variety, wc->pos + 1);
+ snprintf(wc->span.location, sizeof(wc->span.location) - 1,
+ "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
wc->span.manufacturer = "Digium";
- wc->span.devicetype = wc->variety;
+ strncpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype) - 1);
if (alawoverride) {
printk("ALAW override parameter detected. Device will be operating in ALAW\n");
wc->span.deflaw = ZT_LAW_ALAW;
diff --git a/wctdm24xxp/base.c b/wctdm24xxp/base.c
index 4104d8d..b46e0af 100644
--- a/wctdm24xxp/base.c
+++ b/wctdm24xxp/base.c
@@ -3045,10 +3045,12 @@ static int wctdm_initialize(struct wctdm *wc)
/* Zapata stuff */
sprintf(wc->span.name, "WCTDM/%d", wc->pos);
- sprintf(wc->span.desc, "%s Board %d", wc->variety, wc->pos + 1);
- sprintf(wc->span.location, "PCI%s Bus %02d Slot %02d", (wc->flags[0] & FLAG_EXPRESS) ? " Express" : "", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+ snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Board %d", wc->variety, wc->pos + 1);
+ snprintf(wc->span.location, sizeof(wc->span.location) - 1,
+ "PCI%s Bus %02d Slot %02d", (wc->flags[0] & FLAG_EXPRESS) ? " Express" : "",
+ wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
wc->span.manufacturer = "Digium";
- wc->span.devicetype = wc->variety;
+ strncpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype) - 1);
if (alawoverride) {
printk("ALAW override parameter detected. Device will be operating in ALAW\n");
wc->span.deflaw = ZT_LAW_ALAW;
diff --git a/wcte11xp.c b/wcte11xp.c
index 4fa1c94..e5f8b83 100644
--- a/wcte11xp.c
+++ b/wcte11xp.c
@@ -971,10 +971,11 @@ static int t1xxp_software_init(struct t1 *wc)
t4_serial_setup(wc);
wc->num = x;
sprintf(wc->span.name, "WCT1/%d", wc->num);
- sprintf(wc->span.desc, "%s Card %d", wc->variety, wc->num);
+ snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Card %d", wc->variety, wc->num);
wc->span.manufacturer = "Digium";
- wc->span.devicetype = wc->variety;
- sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+ strncpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype) - 1);
+ snprintf(wc->span.location, sizeof(wc->span.location) - 1,
+ "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
wc->span.spanconfig = t1xxp_spanconfig;
wc->span.chanconfig = t1xxp_chanconfig;
wc->span.irq = wc->dev->irq;
diff --git a/wcte12xp.c b/wcte12xp.c
index e75a871..f9d2e69 100644
--- a/wcte12xp.c
+++ b/wcte12xp.c
@@ -1352,10 +1352,11 @@ static int t1_software_init(struct t1 *wc)
wc->num = x;
sprintf(wc->span.name, "WCT1/%d", wc->num);
- sprintf(wc->span.desc, "%s Card %d", wc->variety, wc->num);
+ snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Card %d", wc->variety, wc->num);
wc->span.manufacturer = "Digium";
- wc->span.devicetype = wc->variety;
- sprintf(wc->span.location, "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+ strncpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype) - 1);
+ snprintf(wc->span.location, sizeof(wc->span.location) - 1,
+ "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
wc->span.spanconfig = t1xxp_spanconfig;
wc->span.chanconfig = t1xxp_chanconfig;
diff --git a/wcusb.c b/wcusb.c
index 57619c5..c2b5582 100644
--- a/wcusb.c
+++ b/wcusb.c
@@ -1248,10 +1248,10 @@ static int wc_set_zaptel(struct wc_usb_pvt *p)
}
sprintf(p->span.name, "WCUSB/%d", x);
- sprintf(p->span.desc,"%s %d", p->span.name, x);
+ snprintf(p->span.desc, sizeof(p->span.desc) - 1, "%s %d", p->span.name, x);
sprintf(p->chan.name, "WCUSB/%d/%d", x, 0);
p->span.manufacturer = "Digium";
- p->span.devicetype = p->variety;
+ strncpy(p->span.devicetype, p->variety, sizeof(p->span.devicetype) - 1);
p->chan.sigcap = ZT_SIG_FXOKS | ZT_SIG_FXOLS | ZT_SIG_FXOGS; /* We're capabable of both FXOKS and FXOLS */
p->chan.chanpos = 1;
diff --git a/zaptel-base.c b/zaptel-base.c
index fdcdfa2..c2d1013 100644
--- a/zaptel-base.c
+++ b/zaptel-base.c
@@ -3177,12 +3177,13 @@ static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int c
stack.spaninfo.linecompat = spans[i]->linecompat;
strncpy(stack.spaninfo.lboname, zt_lboname(spans[i]->lbo), sizeof(stack.spaninfo.lboname) - 1);
if (spans[i]->manufacturer)
- strncpy(stack.spaninfo.manufacturer, spans[i]->manufacturer, sizeof(stack.spaninfo.manufacturer));
+ strncpy(stack.spaninfo.manufacturer, spans[i]->manufacturer,
+ sizeof(stack.spaninfo.manufacturer) - 1);
if (spans[i]->devicetype)
- strncpy(stack.spaninfo.devicetype, spans[i]->devicetype, sizeof(stack.spaninfo.devicetype));
- strncpy(stack.spaninfo.location, spans[i]->location, sizeof(stack.spaninfo.location));
+ strncpy(stack.spaninfo.devicetype, spans[i]->devicetype, sizeof(stack.spaninfo.devicetype) - 1);
+ strncpy(stack.spaninfo.location, spans[i]->location, sizeof(stack.spaninfo.location) - 1);
if (spans[i]->spantype)
- strncpy(stack.spaninfo.spantype, spans[i]->spantype, sizeof(stack.spaninfo.spantype));
+ strncpy(stack.spaninfo.spantype, spans[i]->spantype, sizeof(stack.spaninfo.spantype) - 1);
if (copy_to_user((struct zt_spaninfo *) data, &stack.spaninfo, size_to_copy))
return -EFAULT;
diff --git a/zaptel.h b/zaptel.h
index 551faec..b03f73a 100644
--- a/zaptel.h
+++ b/zaptel.h
@@ -1420,7 +1420,7 @@ struct zt_span {
char desc[80]; /* Span description */
const char *spantype; /* span type in text form */
const char *manufacturer; /* span's device manufacturer */
- const char *devicetype; /* span's device type */
+ char devicetype[80]; /* span's device type */
char location[40]; /* span device's location in system */
int deflaw; /* Default law (ZT_MULAW or ZT_ALAW) */
int alarms; /* Pending alarms on span */
diff --git a/ztdummy.c b/ztdummy.c
index 83d5562..5cedaa3 100644
--- a/ztdummy.c
+++ b/ztdummy.c
@@ -260,9 +260,9 @@ static int ztdummy_initialize(struct ztdummy *ztd)
{
/* Zapata stuff */
sprintf(ztd->span.name, "ZTDUMMY/1");
- sprintf(ztd->span.desc, "%s (source: " CLOCK_SRC ") %d", ztd->span.name, 1);
+ snprintf(ztd->span.desc, sizeof(ztd->span.desc) - 1, "%s (source: " CLOCK_SRC ") %d", ztd->span.name, 1);
sprintf(ztd->chan.name, "ZTDUMMY/%d/%d", 1, 0);
- ztd->span.devicetype = "Zaptel Dummy Timing Driver";
+ strncpy(ztd->span.devicetype, "Zaptel Dummy Timing Driver", sizeof(ztd->span.devicetype) - 1);
ztd->chan.chanpos = 1;
ztd->span.chans = &ztd->chan;
ztd->span.channels = 0; /* no channels on our span */