From 95c99bccee69831362da58ebe5e409088eb12296 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Mon, 30 Jun 2014 15:53:46 +0300 Subject: [PATCH] android/client: Fix using unvalidated index to access array 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 949c57483..7b755753b 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); -- 2.47.3