From 588e0062562a6750166023982a5371a26bff3487 Mon Sep 17 00:00:00 2001 From: baohongde Date: Mon, 20 Aug 2018 16:30:08 +0800 Subject: [PATCH] component/bt: Fix bug of SDP find services by uuid always return success --- components/bt/bluedroid/stack/sdp/sdp_discovery.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/bt/bluedroid/stack/sdp/sdp_discovery.c b/components/bt/bluedroid/stack/sdp/sdp_discovery.c index 8f76f2022..d63b164de 100644 --- a/components/bt/bluedroid/stack/sdp/sdp_discovery.c +++ b/components/bt/bluedroid/stack/sdp/sdp_discovery.c @@ -354,15 +354,17 @@ static void sdp_copy_raw_data (tCONN_CB *p_ccb, BOOLEAN offset) type = *p++; p = sdpu_get_len_from_type (p, type, &list_len); } - if (list_len && list_len < cpy_len ) { + if (list_len < cpy_len ) { cpy_len = list_len; } #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("list_len :%d cpy_len:%d raw_size:%d raw_used:%d\n", + SDP_TRACE_DEBUG("list_len :%d cpy_len:%d raw_size:%d raw_used:%d\n", list_len, cpy_len, p_ccb->p_db->raw_size, p_ccb->p_db->raw_used); #endif - memcpy (&p_ccb->p_db->raw_data[p_ccb->p_db->raw_used], p, cpy_len); - p_ccb->p_db->raw_used += cpy_len; + if (cpy_len != 0){ + memcpy (&p_ccb->p_db->raw_data[p_ccb->p_db->raw_used], p, cpy_len); + p_ccb->p_db->raw_used += cpy_len; + } } } #endif