SDP_TRACE_WARNING("list_len: %d, list_byte_count: %d",
p_ccb->list_len, lists_byte_count);
#endif
+
+ if (p_reply + lists_byte_count + 1 /* continuation */ > p_reply_end) {
+ android_errorWriteLog(0x534e4554, "79884292");
+ sdp_disconnect(p_ccb, SDP_INVALID_PDU_SIZE);
+ return;
+ }
+
if (p_ccb->rsp_list == NULL)
- {
- p_ccb->rsp_list = (UINT8 *)GKI_getbuf (SDP_MAX_LIST_BYTE_COUNT);
- if (p_ccb->rsp_list == NULL)
- {
- SDP_TRACE_ERROR ("SDP - no gki buf to save rsp");
- sdp_disconnect (p_ccb, SDP_NO_RESOURCES);
- return;
- }
- }
+ p_ccb->rsp_list = (UINT8 *)osi_malloc(SDP_MAX_LIST_BYTE_COUNT);
memcpy (&p_ccb->rsp_list[p_ccb->list_len], p_reply, lists_byte_count);
p_ccb->list_len += lists_byte_count;
p_reply += lists_byte_count;