You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2019/09/23 13:32:02 UTC
[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on a change in pull
request #579: nimble/host: Fix ble_gap_adv_set_fields for zero length
andrzej-kaczmarek commented on a change in pull request #579: nimble/host: Fix ble_gap_adv_set_fields for zero length
URL: https://github.com/apache/mynewt-nimble/pull/579#discussion_r327115298
##########
File path: nimble/host/src/ble_hs_adv.c
##########
@@ -68,7 +68,9 @@ ble_hs_adv_set_flat_mbuf(uint8_t type, int data_len, const void *data,
{
int rc;
- BLE_HS_DBG_ASSERT(data_len > 0);
+ if (data_len <= 0) {
+ return BLE_HS_EMSGSIZE;
+ }
Review comment:
handling error here makes sense here, but error code should be different (invalid parameters) and it should also be returned if `data` is `NULL`
however, I would keep a debug assert here since `data_len<=0` means application provided invalid parameters and an assert makes it easier to catch it during development. in theory you could set field with 0 length but then it also would make this check invalid. in practice field with length of 0 does not make sense.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services