BT_CHECK_ENABLED_LE(return);
- retv_if(length > 0 && NULL == buf, BLUETOOTH_ERROR_INVALID_PARAM);
+ retv_if(NULL == buf, BLUETOOTH_ERROR_INVALID_PARAM);
+ retv_if(length == 0 || length > BLUETOOTH_TDS_DATA_LENGTH_MAX,
+ BLUETOOTH_ERROR_INVALID_PARAM);
tds_data.length = length;
memcpy(tds_data.data, buf, length);