提交 30bd5726 编写于 作者: R Roel Kluin 提交者: John W. Linville

airo: Reorder tests, check bounds before element

Test whether index is within bounds before reading the element
Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 9b1ce526
......@@ -4790,9 +4790,8 @@ static int proc_stats_rid_open( struct inode *inode,
static int get_dec_u16( char *buffer, int *start, int limit ) {
u16 value;
int valid = 0;
for( value = 0; buffer[*start] >= '0' &&
buffer[*start] <= '9' &&
*start < limit; (*start)++ ) {
for (value = 0; *start < limit && buffer[*start] >= '0' &&
buffer[*start] <= '9'; (*start)++) {
valid = 1;
value *= 10;
value += buffer[*start] - '0';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册