• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


Commit MetaInfo

修訂08a5ae9e2c1b4f40206380cb120e34b791d90242 (tree)
時間2016-09-21 18:09:22
作者Venkata Jagadeesh Garaga <vgaraga@code...>
CommiterVenkata Jagadeesh Garaga

Log Message

SDP: Crash in sdp due to invalid length

Crashed in memcpy as there is no boundary check
for copy length and length exceeds the allocated
buffer size.

Align copy length with source buffer offset
so that copy length will be in boundary of the
allocated buffer size

Change-Id: I4a2e429484378d23c996caffb6495407793548d2
CRs-Fixed: 1069198

Change Summary

差異

--- a/stack/sdp/sdp_discovery.c
+++ b/stack/sdp/sdp_discovery.c
@@ -347,7 +347,7 @@ static void process_service_search_rsp (tCONN_CB *p_ccb, UINT8 *p_reply)
347347 #if (SDP_RAW_DATA_INCLUDED == TRUE)
348348 static void sdp_copy_raw_data (tCONN_CB *p_ccb, BOOLEAN offset)
349349 {
350- unsigned int cpy_len;
350+ unsigned int cpy_len, rem_len;
351351 UINT32 list_len;
352352 UINT8 *p;
353353 UINT8 type;
@@ -378,6 +378,12 @@ static void sdp_copy_raw_data (tCONN_CB *p_ccb, BOOLEAN offset)
378378 {
379379 cpy_len = list_len;
380380 }
381+ rem_len = SDP_MAX_LIST_BYTE_COUNT - (unsigned int) (p - &p_ccb->rsp_list[0]);
382+ if (cpy_len > rem_len)
383+ {
384+ SDP_TRACE_WARNING("rem_len :%d less than cpy_len:%d", rem_len, cpy_len);
385+ cpy_len = rem_len;
386+ }
381387 #if (SDP_DEBUG_RAW == TRUE)
382388 SDP_TRACE_WARNING("list_len :%d cpy_len:%d raw_size:%d raw_used:%d",
383389 list_len, cpy_len, p_ccb->p_db->raw_size, p_ccb->p_db->raw_used);