[PATCHv2 3/6] android/client: Fix using unvalidated index to access array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

Fixes static analyzers warnings.
---
 android/client/if-hl.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/android/client/if-hl.c b/android/client/if-hl.c
index 949c574..7b75575 100644
--- a/android/client/if-hl.c
+++ b/android/client/if-hl.c
@@ -295,7 +295,16 @@ static void close_channel_p(int argc, const char **argv)
 	}
 
 	app_id = (uint32_t) atoi(argv[2]);
+	if (app_id >= APP_ID_SIZE) {
+		haltest_error("Wrong app_id specidied: %u\n", app_id);
+		return;
+	}
+
 	mdep_cfg_index = (uint8_t) atoi(argv[3]);
+	if (mdep_cfg_index >= MDEP_CFG_SIZE) {
+		haltest_error("Wrong mdep cgf index: %u\n", mdep_cfg_index);
+		return;
+	}
 
 	if (app_info[app_id][mdep_cfg_index][2] >= 0) {
 		shutdown(app_info[app_id][mdep_cfg_index][2], SHUT_RDWR);
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux