HciManager::_q_readNotify(): return early when no data is read


The code only handled read result < 0 for an error condition, but
theoretically ::read() could also return 0.
That is very unlikely to happen in practice, because q_readNotify() is
called when QSocketNotifier reports that some data is available.

This also cannot be considered a security issue on its own, because
in this case we'd read garbage from the buffer[0] that was previously
allocated on the stack, and simply end up in the `default:` case of
the code. If the garbage data is equal to HCI_EVENT_PKT or HCI_ACL_PKT,
then the relevant methods should make sure to sanitize the input.

However, let's handle the size == 0 case explicitly and return early
in such case.

Pick-to: 6.9 6.8 6.5
Change-Id: Ic4faedebf50a6d9b9b12d1251a91b4317fd34946
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
commitd8be9e550752d6f5295e2e2f2aaef38dced5c735
parent9ef2307c34f711234e98f26f3ab564e79fcc7ef3
authorIvan Solovev <ivan.solovev@qt.io>
committerIvan Solovev <ivan.solovev@qt.io>
commit timeTue, 20 May 2025 13:00:51 +0200