summaryrefslogtreecommitdiff
path: root/wct4xxp/base.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-04 14:48:23 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-04 14:48:23 +0000
commit068d0fa47a1873bf0dd497a100c8659b2add728e (patch)
treeda0740abcb22011024e7eaf344301ff202e5f666 /wct4xxp/base.c
parent69d38492938f1a7c4d02a1dc63b9af5d6319e661 (diff)
use a buffer for the span's device type instead of a string pointer, so each spans can have dynamically set device types instead of constant strings
also fix up some string creation and copying to be safe against buffer overflows git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3281 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wct4xxp/base.c')
-rw-r--r--wct4xxp/base.c9
1 files changed, 6 insertions, 3 deletions
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";