diff options
author | Szymon Janc <szymon.janc@tieto.com> | 2013-10-23 15:46:25 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-10-23 19:33:03 +0300 |
commit | 3dbfab43729c91d8241a8b2bf01dd621d1877846 (patch) | |
tree | dfc1414b9d9de10a5a17d6afd4d85cd9ff3b0687 /android/hal-ipc.c | |
parent | d7e0cfe033163c7b90d7086ed70d9c9acaa06d24 (diff) | |
download | bluez-3dbfab43729c91d8241a8b2bf01dd621d1877846.tar.gz |
android/hal: Verify if command response service ID match
Received response service ID should match command service ID in
command, abort if it doesn't.
Diffstat (limited to 'android/hal-ipc.c')
-rw-r--r-- | android/hal-ipc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/android/hal-ipc.c b/android/hal-ipc.c index 97a3d295c..8f13e88ad 100644 --- a/android/hal-ipc.c +++ b/android/hal-ipc.c @@ -335,6 +335,12 @@ int hal_ipc_cmd(uint8_t service_id, uint8_t opcode, uint16_t len, void *param, exit(EXIT_FAILURE); } + if (hal_msg.service_id != service_id) { + error("Invalid service id (%u vs %u), aborting", + hal_msg.service_id, service_id); + exit(EXIT_FAILURE); + } + if (ret != (ssize_t) (sizeof(hal_msg) + hal_msg.len)) { error("Malformed response received(%zd bytes), aborting", ret); exit(EXIT_FAILURE); |