From 5499b62ab16fd8dc59f83eccdd01813d8a7f31ee Mon Sep 17 00:00:00 2001 From: markster Date: Thu, 17 Jul 2003 04:18:14 +0000 Subject: Sanity check counts git-svn-id: http://svn.digium.com/svn/zaptel/trunk@216 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- zaptel.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'zaptel.c') 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) -- cgit v1.2.3