From ecdeee200705211e4bec4f788af5badbf1455da4 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Mon, 6 Mar 2000 03:59:03 +0000 Subject: [PATCH] additional checks for getrange ioctl --- comedi/range.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.26.2