mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
airo: Reorder tests, check bounds before element
Test whether index is within bounds before reading the element Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
9b1ce526eb
commit
30bd572673
1 changed files with 2 additions and 3 deletions
|
@ -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';
|
||||
|
|
Loading…
Reference in a new issue