From 068d0fa47a1873bf0dd497a100c8659b2add728e Mon Sep 17 00:00:00 2001 From: kpfleming Date: Tue, 4 Dec 2007 14:48:23 +0000 Subject: 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 --- wctdm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'wctdm.c') 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; -- cgit v1.2.3