summaryrefslogtreecommitdiff
path: root/tools/smp-tester.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-11-29 15:12:46 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2013-11-29 15:12:49 +0200
commit9e08218d0f52f573f9c1d12df650647d4a833d0c (patch)
treeff4d2ca2395c5b67b1fac8fae1fe17b04bb8754b /tools/smp-tester.c
parent1b695735719690c78a5e42ba3b8b449a13cb7245 (diff)
downloadbluez-9e08218d0f52f573f9c1d12df650647d4a833d0c.tar.gz
tools/smp-tester: Improve logging of received SMP PDUs
Diffstat (limited to 'tools/smp-tester.c')
-rw-r--r--tools/smp-tester.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/smp-tester.c b/tools/smp-tester.c
index aa55402e1..05d620a68 100644
--- a/tools/smp-tester.c
+++ b/tools/smp-tester.c
@@ -661,7 +661,14 @@ static void smp_server(const void *data, uint16_t len, void *user_data)
const void *pdu;
uint8_t opcode;
- tester_print("Received SMP PDU");
+ if (len < 1) {
+ tester_warn("Received too small SMP PDU");
+ goto failed;
+ }
+
+ opcode = *((const uint8_t *) data);
+
+ tester_print("Received SMP opcode 0x%02x", opcode);
if (test_data->counter >= smp->req_count) {
tester_test_passed();
@@ -678,8 +685,6 @@ static void smp_server(const void *data, uint16_t len, void *user_data)
goto failed;
}
- opcode = *((const uint8_t *) data);
-
switch (opcode) {
case 0x01: /* Pairing Request */
memcpy(test_data->smp_preq, data, sizeof(test_data->smp_preq));