BlueZ: check packet size before casting to MgmtEventDeviceFound
The code that is parsing the Bluetooth Management commands was checking
the size of the MgmtHdr before extracting it, but was never checking
that the MgmtHdr::length parameter actually a value that is enough to
fit the MgmtEventDeviceFound struct.
If the actual length of the data was less than the size of the
MgmtEventDeviceFound struct, we were reading the data past the end of
the buffer.
Note that this was very unlikely to happen in practice, because the
incorrect data has to be sent from the Linux kernel or from a malicious
privileged process.
Task-number: QTBUG-145934
Pick-to: 6.11 6.8
Change-Id: I4be6a6d42c97490054f10d34dd86c0a70875157b
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>