summaryrefslogtreecommitdiff
path: root/wcfxo.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 /wcfxo.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 'wcfxo.c')
-rw-r--r--wcfxo.c7
1 files changed, 4 insertions, 3 deletions
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;