diff options
author | Inga Stotland <inga.stotland@intel.com> | 2020-11-05 23:10:53 -0800 |
---|---|---|
committer | Brian Gix <brian.gix@intel.com> | 2020-11-10 10:24:11 -0800 |
commit | dac8ef3b0a54708f34293e87c261a9e4f6630e0e (patch) | |
tree | c0113b17e86391bc694ec187cb99765ae4777f2b /mesh/cfgmod-server.c | |
parent | 02e46e9df6b0d897e6ba67dc3ea18e5e9c510e44 (diff) | |
download | bluez-dac8ef3b0a54708f34293e87c261a9e4f6630e0e.tar.gz |
mesh: Fix errors found by static analysis
This fixes a NULL pointer dereference error (cfgmod-server.c)
and miscellaneous issues related to unchecked return status.
Diffstat (limited to 'mesh/cfgmod-server.c')
-rw-r--r-- | mesh/cfgmod-server.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c index 0009a1bee..5eefedc4d 100644 --- a/mesh/cfgmod-server.c +++ b/mesh/cfgmod-server.c @@ -80,13 +80,12 @@ static uint16_t config_pub_get(struct mesh_node *node, const uint8_t *pkt, pub = mesh_model_pub_get(node, ele_addr, id, &status); - rtx = pub->rtx.cnt + (((pub->rtx.interval / 50) - 1) << 3); - - if (pub && status == MESH_STATUS_SUCCESS) + if (pub && status == MESH_STATUS_SUCCESS) { + rtx = pub->rtx.cnt + (((pub->rtx.interval / 50) - 1) << 3); return set_pub_status(status, ele_addr, id, pub->addr, pub->idx, pub->credential, pub->ttl, pub->period, rtx); - else + } else return set_pub_status(status, ele_addr, id, 0, 0, 0, 0, 0, 0); } @@ -592,12 +591,7 @@ static uint16_t cfg_appkey_msg(struct mesh_node *node, const uint8_t *pkt, struct mesh_net *net = node_get_net(node); n_idx = l_get_le16(pkt) & 0xfff; - if (n_idx > NET_IDX_MAX) - return 0; - a_idx = l_get_le16(pkt + 1) >> 4; - if (a_idx > APP_IDX_MAX) - return 0; n = mesh_model_opcode_set(OP_APPKEY_STATUS, msg); |