summaryrefslogtreecommitdiff
path: root/zaptel.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2003-07-17 04:18:14 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2003-07-17 04:18:14 +0000
commit5499b62ab16fd8dc59f83eccdd01813d8a7f31ee (patch)
tree8cfe1f30f9e844bdb5776cd24740ce5aaa49cc96 /zaptel.c
parent97c18d89852068b29e9e4100caa451de06c0700c (diff)
Sanity check counts
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@216 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zaptel.c')
-rwxr-xr-xzaptel.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/zaptel.c b/zaptel.c
index db098f6..4ad2715 100755
--- a/zaptel.c
+++ b/zaptel.c
@@ -1394,6 +1394,8 @@ static ssize_t zt_chan_read(struct file *file, char *usrbuf, size_t count, int u
int res, rv;
int oldbuf,x;
unsigned long flags;
+ /* Make sure count never exceeds 65k, and make sure it's unsigned */
+ count &= 0xffff;
if (!chan)
return -EINVAL;
if (count < 1)
@@ -1470,6 +1472,8 @@ static ssize_t zt_chan_write(struct file *file, const char *usrbuf, size_t count
unsigned long flags;
struct zt_chan *chan = chans[unit];
int res, amnt, oldbuf, rv,x;
+ /* Make sure count never exceeds 65k, and make sure it's unsigned */
+ count &= 0xffff;
if (!chan)
return -EINVAL;
if (count < 1)