From: David Schleef Date: Mon, 6 Mar 2000 03:59:03 +0000 (+0000) Subject: additional checks for getrange ioctl X-Git-Tag: r0_7_40~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ecdeee200705211e4bec4f788af5badbf1455da4;p=comedi.git additional checks for getrange ioctl --- diff --git a/comedi/range.c b/comedi/range.c index eba0aed1..3c1fc09d 100644 --- a/comedi/range.c +++ b/comedi/range.c @@ -76,6 +76,12 @@ int do_rangeinfo_ioctl(comedi_device *dev,comedi_rangeinfo *arg) return -EINVAL; } + if( (it.range_type&0xffff) != lr->length){ + DPRINTK("wrong length %d should be %d (0x%08lx)\n", + it.range_type&0xffff,lr->length,it.range_type); + return -EINVAL; + } + if(copy_to_user(it.range_ptr,lr->range, sizeof(comedi_krange)*lr->length)) return -EFAULT;