diff options
author | kpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-12-04 14:48:23 +0000 |
---|---|---|
committer | kpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-12-04 14:48:23 +0000 |
commit | 068d0fa47a1873bf0dd497a100c8659b2add728e (patch) | |
tree | da0740abcb22011024e7eaf344301ff202e5f666 /wct1xxp.c | |
parent | 69d38492938f1a7c4d02a1dc63b9af5d6319e661 (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 'wct1xxp.c')
-rw-r--r-- | wct1xxp.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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; |