Skip to content

Commit

Permalink
airo: Reorder tests, check bounds before element
Browse files Browse the repository at this point in the history
Test whether index is within bounds before reading the element

Signed-off-by: Roel Kluin <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
  • Loading branch information
RoelKluin authored and linvjw committed Oct 27, 2009
1 parent 9b1ce52 commit 30bd572
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/net/wireless/airo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 30bd572

Please sign in to comment.