]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: Fix buffer overflow with variable length commands
authorJohan Hedberg <johan.hedberg@intel.com>
Thu, 3 Jul 2014 10:52:27 +0000 (13:52 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 3 Jul 2014 15:42:59 +0000 (17:42 +0200)
commitd28d0fbafa9e83cb7393958055ea6a49271b5805
tree7c5d003f401165f6c7eac97d2541c702dcdfd3ef
parent8107fe711d567f2f70b1cdf027c29429479941c4
Bluetooth: Fix buffer overflow with variable length commands

The handler for variable length commands were trying to calculate the
expected length of the command based on the given parameter count, and
then comparing that with the received data. However, the expected count
was stored in a u16 which can easily overflow. With a carefully crafted
command this can then be made to match the given data even though the
parameter count is actually way too big, resulting in a buffer overflow
when parsing the parameters.

This patch fixes the issue by calculating a per-command maximum
parameter count and returns INVALID_PARAMS if it is exceeded.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/mgmt.c