summaryrefslogtreecommitdiff
path: root/kernel/zaptel-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/zaptel-base.c')
-rw-r--r--kernel/zaptel-base.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/kernel/zaptel-base.c b/kernel/zaptel-base.c
index ce42499..4aa2161 100644
--- a/kernel/zaptel-base.c
+++ b/kernel/zaptel-base.c
@@ -1269,7 +1269,7 @@ static devfs_handle_t register_devfs_channel(struct zt_chan *chan, devfs_handle_
/* Set up the path of the file/link itself */
tmp_offset = devfs_generate_path(zaptel_devfs_dir, tmp, sizeof(tmp) - 1);
sprintf(buf, "/%d", chan->channo);
- strncpy(path, tmp+tmp_offset, sizeof(path) - 1);
+ zap_copy_string(path, tmp+tmp_offset, sizeof(path));
strncat(path, buf, sizeof(path) - 1);
err = devfs_mk_symlink(NULL, path, DEVFS_FL_DEFAULT, link+link_offset, &chan->fhandle_symlink, NULL);
@@ -2638,7 +2638,7 @@ static int ioctl_load_zone(unsigned long data)
ptr += sizeof(*z);
space -= sizeof(*z);
- strncpy(z->name, th.name, sizeof(z->name) - 1);
+ zap_copy_string(z->name, th.name, sizeof(z->name));
for (x = 0; x < ZT_MAX_CADENCE; x++)
z->ringcadence[x] = th.ringcadence[x];
@@ -3101,7 +3101,7 @@ static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int c
stack.param.pulseaftertime = chan->pulseaftertime;
if (chan->span) stack.param.spanno = chan->span->spanno;
else stack.param.spanno = 0;
- strncpy(stack.param.name, chan->name, sizeof(stack.param.name) - 1);
+ zap_copy_string(stack.param.name, chan->name, sizeof(stack.param.name));
stack.param.chanpos = chan->chanpos;
stack.param.sigcap = chan->sigcap;
/* Return current law */
@@ -3236,8 +3236,8 @@ static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int c
stack.spaninfo.spanno = i; /* put the span # in here */
stack.spaninfo.totalspans = 0;
if (maxspans) stack.spaninfo.totalspans = maxspans - 1; /* put total number of spans here */
- strncpy(stack.spaninfo.desc, spans[i]->desc, sizeof(stack.spaninfo.desc) - 1);
- strncpy(stack.spaninfo.name, spans[i]->name, sizeof(stack.spaninfo.name) - 1);
+ zap_copy_string(stack.spaninfo.desc, spans[i]->desc, sizeof(stack.spaninfo.desc));
+ zap_copy_string(stack.spaninfo.name, spans[i]->name, sizeof(stack.spaninfo.name));
stack.spaninfo.alarms = spans[i]->alarms; /* get alarm status */
stack.spaninfo.bpvcount = spans[i]->bpvcount; /* get BPV count */
stack.spaninfo.rxlevel = spans[i]->rxlevel; /* get rx level */
@@ -3259,15 +3259,15 @@ static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int c
/* version 3 fields */
stack.spaninfo.irq = spans[i]->irq;
stack.spaninfo.linecompat = spans[i]->linecompat;
- strncpy(stack.spaninfo.lboname, zt_lboname(spans[i]->lbo), sizeof(stack.spaninfo.lboname) - 1);
+ zap_copy_string(stack.spaninfo.lboname, zt_lboname(spans[i]->lbo), sizeof(stack.spaninfo.lboname));
if (spans[i]->manufacturer)
- strncpy(stack.spaninfo.manufacturer, spans[i]->manufacturer,
- sizeof(stack.spaninfo.manufacturer) - 1);
+ zap_copy_string(stack.spaninfo.manufacturer, spans[i]->manufacturer,
+ sizeof(stack.spaninfo.manufacturer));
if (spans[i]->devicetype)
- strncpy(stack.spaninfo.devicetype, spans[i]->devicetype, sizeof(stack.spaninfo.devicetype) - 1);
- strncpy(stack.spaninfo.location, spans[i]->location, sizeof(stack.spaninfo.location) - 1);
+ zap_copy_string(stack.spaninfo.devicetype, spans[i]->devicetype, sizeof(stack.spaninfo.devicetype));
+ zap_copy_string(stack.spaninfo.location, spans[i]->location, sizeof(stack.spaninfo.location));
if (spans[i]->spantype)
- strncpy(stack.spaninfo.spantype, spans[i]->spantype, sizeof(stack.spaninfo.spantype) - 1);
+ zap_copy_string(stack.spaninfo.spantype, spans[i]->spantype, sizeof(stack.spaninfo.spantype));
if (copy_to_user((struct zt_spaninfo *) data, &stack.spaninfo, size_to_copy))
return -EFAULT;
@@ -3722,7 +3722,7 @@ static int zt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd
break;
case ZT_GETVERSION:
memset(&vi, 0, sizeof(vi));
- strncpy(vi.version, ZAPTEL_VERSION, sizeof(vi.version) - 1);
+ zap_copy_string(vi.version, ZAPTEL_VERSION, sizeof(vi.version));
echo_can_identify(vi.echo_canceller, sizeof(vi.echo_canceller) - 1);
if (copy_to_user((struct zt_versioninfo *) data, &vi, sizeof(vi)))
return -EFAULT;
@@ -3840,7 +3840,7 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign
rv = -EBUSY;
break;
}
- strncpy(chan->txdialbuf + strlen(chan->txdialbuf), stack.tdo.dialstr, ZT_MAX_DTMF_BUF - strlen(chan->txdialbuf) - 1);
+ zap_copy_string(chan->txdialbuf + strlen(chan->txdialbuf), stack.tdo.dialstr, ZT_MAX_DTMF_BUF - strlen(chan->txdialbuf));
if (!chan->dialing) {
chan->dialing = 1;
__do_dtmf(chan);