diff options
author | Tedd Ho-Jeong An <tedd.an@intel.com> | 2022-06-22 21:45:20 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-06-23 16:24:57 -0700 |
commit | e3c92f1f786f0b55440bd908b55894d0c792cf0e (patch) | |
tree | acaa516d20226a2b03522cefc02d1014d26d50a6 /tools | |
parent | 7f92f75e88b66ba73db5a676c35c704e213dcd70 (diff) | |
download | bluez-e3c92f1f786f0b55440bd908b55894d0c792cf0e.tar.gz |
mgmt-tester: Fix null dereference issue reported by scan-build
This patch fixes the null dereference reported by the scan-build.
tools/mgmt-tester.c:12025:28: warning: Access to field 'cap_len' results
in a dereference of a null pointer (loaded from variable 'rp')
[core.NullDereference]
if (sizeof(rp->cap_len) + rp->cap_len != length) {
^~~~~~~~~~~
Diffstat (limited to 'tools')
-rw-r--r-- | tools/mgmt-tester.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index f45a6c015..6018327f1 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -12020,12 +12020,14 @@ static void read_50_controller_cap_complete(uint8_t status, uint16_t length, tester_warn("Failed to read advertising features: %s (0x%02x)", mgmt_errstr(status), status); tester_test_failed(); + return; } if (sizeof(rp->cap_len) + rp->cap_len != length) { tester_warn("Controller capabilities malformed, size %zu != %u", sizeof(rp->cap_len) + rp->cap_len, length); tester_test_failed(); + return; } while (offset < rp->cap_len) { |