Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] android/handsfree-client: Verify variable length data received from IPC
@ 2014-09-26 10:04 Jakub Tyszkowski
  2014-09-26 10:28 ` Szymon Janc
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Tyszkowski @ 2014-09-26 10:04 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

Dial uses variable length data, check if we received as much as was
declared. This fixes two negative ipc-tester cases for hfp-client dial
api call not passing.
---
 android/handsfree-client.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/android/handsfree-client.c b/android/handsfree-client.c
index be29952..773ef76 100644
--- a/android/handsfree-client.c
+++ b/android/handsfree-client.c
@@ -97,6 +97,15 @@ static void handle_volume_control(const void *buf, uint16_t len)
 
 static void handle_dial(const void *buf, uint16_t len)
 {
+	const struct hal_cmd_hf_client_dial *cmd = buf;
+
+	if (len != sizeof(*cmd) + cmd->number_len) {
+		error("Malformed number data, size (%u bytes), terminating",
+									len);
+		raise(SIGTERM);
+		return;
+	}
+
 	DBG("Not Implemented");
 	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HANDSFREE_CLIENT,
 				HAL_OP_HF_CLIENT_DIAL, HAL_STATUS_UNSUPPORTED);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-26 10:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-26 10:04 [PATCH] android/handsfree-client: Verify variable length data received from IPC Jakub Tyszkowski
2014-09-26 10:28 ` Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox