diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2003-07-17 04:18:14 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2003-07-17 04:18:14 +0000 |
commit | 5499b62ab16fd8dc59f83eccdd01813d8a7f31ee (patch) | |
tree | 8cfe1f30f9e844bdb5776cd24740ce5aaa49cc96 /zaptel.c | |
parent | 97c18d89852068b29e9e4100caa451de06c0700c (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-x | zaptel.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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) |