Re: [2.6 PATCH] IPV6: Check length of optval provided by user in setsockopt()
From: Wang Chen <hidden>
Date: 2008-03-31 10:47:09
From: Wang Chen <hidden>
Date: 2008-03-31 10:47:09
YOSHIFUJI Hideaki / 吉藤英明 said the following on 2008-3-31 17:15:
In article [ref] (at Mon, 31 Mar 2008 17:08:38 +0800), Wang Chen [off-list ref] says:quoted
Check length of setsockopt's optval, which provided by user, before copy it from user space.Please use "<" not "==".
There are two reasons that why I only check whether len of optval is equal to that one in user space. 1. We currently copy the entire structure from user to kernel. 2. In other cases, such as IPV6_LEAVE/JOIN_ANYCAST, we check whether the len is equal to struct's len. So, Yoshifuji-san, can you tell me more about why we should use "<"? :) --WCN