diff --git a/tools/smp-tester.c b/tools/smp-tester.c
index aa55402..05d620a 100644
--- a/tools/smp-tester.c
+++ b/tools/smp-tester.c
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();
goto failed;
}
- opcode = *((const uint8_t *) data);
-
switch (opcode) {
case 0x01: /* Pairing Request */
memcpy(test_data->smp_preq, data, sizeof(test_data->smp_preq));