Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] android/client: Fix pin reply call when pin argument missing in cmd
@ 2013-11-01 12:20 Ravi kumar Veeramally
  2013-11-01 13:11 ` Johan Hedberg
  0 siblings, 1 reply; 3+ messages in thread
From: Ravi kumar Veeramally @ 2013-11-01 12:20 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ravi kumar Veeramally

If condition checks number of arguments properly but still executes
EXEC command. It should display error message and return.
---
 android/client/if-bt.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/android/client/if-bt.c b/android/client/if-bt.c
index 3d97458..2c3cc4a 100644
--- a/android/client/if-bt.c
+++ b/android/client/if-bt.c
@@ -719,12 +719,15 @@ static void pin_reply_p(int argc, const char **argv)
 	RETURN_IF_NULL(if_bluetooth);
 	VERIFY_ADDR_ARG(2, &addr);
 
-	if (argc > 3) {
-		accept = 1;
-		pin_len = strlen(argv[3]);
-		memcpy(pin.pin, argv[3], pin_len);
+	if (argc != 4) {
+		haltest_error("Usage <address> <pin>\n");
+		return;
 	}
 
+	accept = 1;
+	pin_len = strlen(argv[3]);
+	memcpy(pin.pin, argv[3], pin_len);
+
 	EXEC(if_bluetooth->pin_reply, &addr, accept, pin_len, &pin);
 }
 
-- 
1.8.1.2


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

end of thread, other threads:[~2013-11-04  8:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-01 12:20 [PATCH] android/client: Fix pin reply call when pin argument missing in cmd Ravi kumar Veeramally
2013-11-01 13:11 ` Johan Hedberg
2013-11-04  8:40   ` Jerzy Kasenberg

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