From dbe575cbe29e92146e9e69f9aba8c33f60c1824e Mon Sep 17 00:00:00 2001 From: Wootak Jung Date: Fri, 27 Nov 2020 13:29:17 +0900 Subject: [PATCH] Fix tds data check logic length can be -1 if tds data is NULL Change-Id: I8c601d24ef421cde142b99f7f8d21bfa8420f7f5 Signed-off-by: Wootak Jung --- bt-service/services/tds/bt-service-tds.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bt-service/services/tds/bt-service-tds.c b/bt-service/services/tds/bt-service-tds.c index 109f900..aaf2d60 100644 --- a/bt-service/services/tds/bt-service-tds.c +++ b/bt-service/services/tds/bt-service-tds.c @@ -449,8 +449,10 @@ static int __bt_tds_set_advertising(bt_tds_provider_t *provider) /* Get updated TDS advertising data */ length = __bt_tds_provider_get_tds_multi_adv_data(provider, adv.data); - if (length == 0) + if (length <= 0) { + BT_ERR("No tds data"); return BLUETOOTH_ERROR_NONE; + } for (i = 0; i < length; i++) BT_DBG("adv_data: 0x%x", adv.data[i]); -- 2.7.4