OSDN Git Service
(root)
/
android-x86
/
external-bluetooth-bluez.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fc10c55
)
android/hal: Verify command status response before processing
author
Szymon Janc
<szymon.janc@tieto.com>
Mon, 18 Nov 2013 12:58:40 +0000
(13:58 +0100)
committer
Johan Hedberg
<johan.hedberg@intel.com>
Mon, 18 Nov 2013 13:17:24 +0000
(15:17 +0200)
This makes HAL IPC code verify error reply before processing it. It
also verify if success status was reported according to IPC spec.
android/hal-ipc.c
patch
|
blob
|
history
diff --git
a/android/hal-ipc.c
b/android/hal-ipc.c
index
026e245
..
5155e04
100644
(file)
--- a/
android/hal-ipc.c
+++ b/
android/hal-ipc.c
@@
-367,6
+367,17
@@
int hal_ipc_cmd(uint8_t service_id, uint8_t opcode, uint16_t len, void *param,
if (cmd.opcode == HAL_OP_STATUS) {
struct hal_status *s = rsp;
+
+ if (sizeof(*s) != cmd.len) {
+ error("Invalid status length, aborting");
+ exit(EXIT_FAILURE);
+ }
+
+ if (s->code == HAL_STATUS_SUCCESS) {
+ error("Invalid success status response, aborting");
+ exit(EXIT_FAILURE);
+ }
+
return s->code;
}