libertas: Read buffer overflow
authorRoel Kluin <roel.kluin@gmail.com>
Sun, 2 Aug 2009 07:44:12 +0000 (09:44 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 3 Aug 2009 20:31:23 +0000 (16:31 -0400)
Check whether index is within bounds before testing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/11d.c

index 9a5408e7d94a1a3949fc35a5a12b0e206631d28d..5c6968101f0d1ce8dea7d50802175e1d940827b5 100644 (file)
@@ -47,7 +47,7 @@ static u8 lbs_region_2_code(u8 *region)
 {
        u8 i;
 
-       for (i = 0; region[i] && i < COUNTRY_CODE_LEN; i++)
+       for (i = 0; i < COUNTRY_CODE_LEN && region[i]; i++)
                region[i] = toupper(region[i]);
 
        for (i = 0; i < ARRAY_SIZE(region_code_mapping); i++) {