diff options
author | Ryota Okubi <ryota.okubi@mail.toyota-td.jp> | 2014-09-12 13:21:21 +0900 |
---|---|---|
committer | Mikko Ylinen <mikko.ylinen@intel.com> | 2014-10-06 03:59:35 -0700 |
commit | a4837bd50f26e69adfc85ae0c18799154c3f58bc (patch) | |
tree | 038226d3b9c622ccbc7fc214fc5418f2b2ad8e40 | |
parent | 9447cd666bbd8e6f3933c194ccc09f2768378a86 (diff) | |
download | ico-uxf-weston-plugin-a4837bd50f26e69adfc85ae0c18799154c3f58bc.tar.gz ico-uxf-weston-plugin-a4837bd50f26e69adfc85ae0c18799154c3f58bc.tar.bz2 ico-uxf-weston-plugin-a4837bd50f26e69adfc85ae0c18799154c3f58bc.zip |
bug fix: If input data is mistaken, ico_send_inputevent tool will crash.
Change-Id: Ib267a975ada8dc8f9994480ac19bfafa9bc0d76f
Signed-off-by: Ryota Okubi <ryota.okubi@mail.toyota-td.jp>
-rw-r--r-- | tools/ico_send_inputevent.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/ico_send_inputevent.c b/tools/ico_send_inputevent.c index 8840ca9..670e712 100644 --- a/tools/ico_send_inputevent.c +++ b/tools/ico_send_inputevent.c @@ -370,7 +370,7 @@ send_event(const char *cmd) j = 0; for (i = 0; cmd[i]; i++) { if ((cmd[i] == '=') || (cmd[i] == ' ')) break; - if (j < (int)(sizeof(prop)-1)) { + if (j < (int)(sizeof(prop)-2)) { prop[j++] = cmd[i]; } } @@ -380,7 +380,7 @@ send_event(const char *cmd) if (cmd[i] != 0) { for (i++; cmd[i]; i++) { if (cmd[i] == ' ') continue; - if (j < (int)(sizeof(value)-1)) { + if (j < (int)(sizeof(value)-2)) { value[j++] = cmd[i]; } } @@ -421,21 +421,21 @@ send_event(const char *cmd) } if (! event_key[key].prop[0]) { for (key2 = 0; event_keyboard[key2].prop[0]; key2++) { - if (strcasecmp(prop, event_key[key2].prop) == 0) break; + if (strcasecmp(prop, event_keyboard[key2].prop) == 0) break; if ((strncasecmp(prop, "key.", 4) == 0) && - (strcasecmp(&prop[4], event_key[key2].prop) == 0)) break; + (strcasecmp(&prop[4], event_keyboard[key2].prop) == 0)) break; wkpress = 1; if ((strncasecmp(prop, "press.", 6) == 0) && - (strcasecmp(&prop[6], event_key[key2].prop) == 0)) break; + (strcasecmp(&prop[6], event_keyboard[key2].prop) == 0)) break; if ((strncasecmp(prop, "keypress.", 9) == 0) && - (strcasecmp(&prop[9], event_key[key2].prop) == 0)) break; + (strcasecmp(&prop[9], event_keyboard[key2].prop) == 0)) break; wkpress = 0; if ((strncasecmp(prop, "release.", 8) == 0) && - (strcasecmp(&prop[8], event_key[key2].prop) == 0)) break; + (strcasecmp(&prop[8], event_keyboard[key2].prop) == 0)) break; if ((strncasecmp(prop, "keyrelease.", 11) == 0) && - (strcasecmp(&prop[11], event_key[key2].prop) == 0)) break; + (strcasecmp(&prop[11], event_keyboard[key2].prop) == 0)) break; } - if (! event_key[key2].prop[0]) { + if (! event_keyboard[key2].prop[0]) { print_log("UnKnown Event name[%s]", prop); return; } |