Adding validation condition for underflow and overflow of int "section_number" used... 56/87256/3
authorSanjeev Kumar <sanjeev1.k@samsung.com>
Wed, 7 Sep 2016 07:07:34 +0000 (12:37 +0530)
committerSung-Jin Park <sj76.park@samsung.com>
Thu, 22 Sep 2016 04:08:24 +0000 (21:08 -0700)
Change-Id: I37e40c4cd61fbb4a5aba3466baa5efcdf3caf84b
Signed-off-by: Sanjeev Kumar <sanjeev1.k@samsung.com>
src/e_mod_keyrouter_combination.c

index 2842735..0e4dfcc 100644 (file)
@@ -24,6 +24,7 @@
 #define DBUS_IFACE "keyrouter.dbus.Signal"\r
 #define DBUS_MSG_NAME "KEY_COMBINATION"\r
 #define COMBINATION_TIME_OUT 4000\r
+#define MAX_SUPPORTED_COMBINATION 255\r
 #define MATCH(s, n) strcmp(section, s) == 0 && strcmp(name, n) == 0\r
 \r
 typedef unsigned long Time;\r
@@ -145,9 +146,9 @@ _e_keyrouter_parse_ini_config(void* user, const char* section, const char* name,
    section_number = atoi(c_num);\r
    free(c_num);\r
    free(dup);\r
-   if (section_number == 0)\r
+   if (section_number <= 0 || section_number > MAX_SUPPORTED_COMBINATION)\r
      {\r
-        KLWRN("\n^[[36m Unable to read config. section_number is 0. ^[[0m\n");\r
+        KLWRN("\n^[[36m Unable to read config. section_number is invalid. ^[[0m\n");\r
         return -1;\r
      }\r
    section_number--;\r