Fix the routine checking a parameter 'buttons'. 23/138623/1 accepted/tizen/unified/20170713.153740 submit/tizen/20170713.052302
authorDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 13 Jul 2017 04:51:31 +0000 (13:51 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 13 Jul 2017 04:51:31 +0000 (13:51 +0900)
The value of 'buttons' can be 0(BUTTON_NONE) and combined each other.

Change-Id: Ia9ccecb83a9b375c62fd8daa9047fef3c6d1aeda
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
src/bluetooth-hid.c

index b4796387a9b5dcba74a5428cfd28c1257a4365b1..8c1e529ffb6526c6572d236d7a7af28196789710 100644 (file)
@@ -226,9 +226,9 @@ int bt_hid_device_send_mouse_event(const char *remote_address,
        BT_CHECK_INPUT_PARAMETER(remote_address);
        BT_CHECK_INPUT_PARAMETER(mouse_data);
 
-       if (mouse_data->buttons != BT_HID_MOUSE_BUTTON_LEFT ||
-               mouse_data->buttons != BT_HID_MOUSE_BUTTON_RIGHT ||
-               mouse_data->buttons != BT_HID_MOUSE_BUTTON_MIDDLE) {
+       if ((mouse_data->buttons < BT_HID_MOUSE_BUTTON_NONE) ||
+           (mouse_data->buttons > (BT_HID_MOUSE_BUTTON_LEFT |
+             BT_HID_MOUSE_BUTTON_RIGHT | BT_HID_MOUSE_BUTTON_MIDDLE))) {
                return BT_ERROR_INVALID_PARAMETER;
        }