pepper-keyrouter: fix a coverity issue 34/213334/1 accepted/tizen_5.5_unified_mobile_hotfix tizen_5.5_mobile_hotfix tizen_5.5_tv accepted/tizen/5.5/unified/20191031.021304 accepted/tizen/5.5/unified/mobile/hotfix/20201027.080649 accepted/tizen/unified/20190905.060551 submit/tizen/20190904.101310 submit/tizen_5.5/20191031.000005 submit/tizen_5.5_mobile_hotfix/20201026.185105 tizen_5.5.m2_release
authorjeon <jhyuni.kang@samsung.com>
Wed, 4 Sep 2019 08:34:32 +0000 (17:34 +0900)
committerjeon <jhyuni.kang@samsung.com>
Wed, 4 Sep 2019 08:34:34 +0000 (17:34 +0900)
  - PEPPER_CHECK is definition to check invalid values
    using do-while, so continue command is not work
    intentionally.
  - so change to check value condition if instead
    PEPPER_CHECK(do-while)

Change-Id: I2ca32e30b53e8ae2f23114233855ad3224d7895a

src/lib/keyrouter/pepper-keyrouter.c

index 2606c8e..d378e69 100644 (file)
@@ -689,8 +689,10 @@ _pepper_keyrouter_options_set(pepper_keyrouter_t *pepper_keyrouter)
                tmp = strtok_r(NULL, " ", &buf_ptr);
                if (!tmp) continue;
                keycode = atoi(tmp);
-               PEPPER_CHECK(((0 < keycode) && (keycode < KEYROUTER_MAX_KEYS)),
-                       continue, "Currently %d key is invalid to support\n", keycode);
+               if ((0 >= keycode) || (keycode >= KEYROUTER_MAX_KEYS)) {
+                       PEPPER_ERROR("Currently %d key is invalid to support\n", keycode);
+                       continue;
+               }
 
                pepper_keyrouter->opts[keycode].enabled = PEPPER_TRUE;