From fac46295447bedcedd203c1983afaa4f9c8b8f05 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Wed, 20 May 2015 19:10:43 +0200 Subject: [PATCH] emulator: Verify Set Controller To Host Flow Control Command Return invalid parameters error if reserved value is used. --- emulator/btdev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index 2a0c673be..a2a2e509c 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -2393,8 +2393,12 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, case BT_HCI_CMD_SET_HOST_FLOW_CONTROL: shfc = data; - btdev->host_flow_control = shfc->enable; - status = BT_HCI_ERR_SUCCESS; + if (shfc->enable > 0x03) { + status = BT_HCI_ERR_INVALID_PARAMETERS; + } else { + btdev->host_flow_control = shfc->enable; + status = BT_HCI_ERR_SUCCESS; + } cmd_complete(btdev, opcode, &status, sizeof(status)); break; -- 2.47.3