OSDN Git Service

Decrease length after reading from array in process_service_attr_req
authorJakub Pawlowski <jpawlowski@google.com>
Tue, 29 May 2018 23:25:56 +0000 (16:25 -0700)
committerRyan Longair <rlongair@google.com>
Tue, 12 Jun 2018 18:14:33 +0000 (11:14 -0700)
Test: compilation
Bug: 78136677
Change-Id: I4807a350e2b4764a93f104ce88f23a957a7e85c0
Merged-In: I4807a350e2b4764a93f104ce88f23a957a7e85c0
(cherry picked from commit 76e962892ea1419f69e3c7e26a09fa77948c46e6)

stack/sdp/sdp_server.c

index 2d34406..100d35b 100644 (file)
@@ -351,9 +351,11 @@ static void process_service_attr_req (tCONN_CB *p_ccb, UINT16 trans_num,
 
     /* Extract the record handle */
     BE_STREAM_TO_UINT32 (rec_handle, p_req);
+    param_len -= sizeof(rec_handle);
 
     /* Get the max list length we can send. Cap it at MTU size minus overhead */
     BE_STREAM_TO_UINT16 (max_list_len, p_req);
+    param_len -= sizeof(max_list_len);
 
     if (max_list_len > (p_ccb->rem_mtu_size - SDP_MAX_ATTR_RSPHDR_LEN))
         max_list_len = p_ccb->rem_mtu_size - SDP_MAX_ATTR_RSPHDR_LEN;