BlueZ LE Advertiser: fix potential integer underflow
The right side of the comparison is implicitly converted to qulonglong,
and then, with manufacturerData long enough, an unsigned integer
underflow happens, which leads to a number close to ULONGLONG_MAX on
the right side. As a result, the check produces wrong result, and we
end up writing past the end of the allocated dest.data[] buffer.
Fix by rewriting the check to avoid underflows.
In this case the manufacturer data comes from the application, not
from untrusted third-party device, but there's still a chance that
the application provides too much data and trigger this problem.
Picking this patch all the way to 5.15, because in the older branches
it was the main solution for LE advertising, while the newer versions
use D-Bus based approach.
Task-number: QTBUG-145934
Pick-to: 6.11 6.8 6.5 5.15
Change-Id: I94599c4a9afb73b31ee0da692a735b20fb00f8b2
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>