Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8ffe8ed authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Merge "Fix copy length calculation in sdp_copy_raw_data" into oc-dev

am: d9fc30c3

Change-Id: Ic8e44e7546ba67ef3500d4d7d13de2ddd1382261
parents 8d6ca279 d9fc30c3
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -352,8 +352,15 @@ static void sdp_copy_raw_data(tCONN_CB* p_ccb, bool offset) {
    p = &p_ccb->rsp_list[0];

    if (offset) {
      cpy_len -= 1;
      type = *p++;
      uint8_t* old_p = p;
      p = sdpu_get_len_from_type(p, type, &list_len);
      if ((int)cpy_len < (p - old_p)) {
        SDP_TRACE_WARNING("%s: no bytes left for data", __func__);
        return;
      }
      cpy_len -= (p - old_p);
    }
    if (list_len < cpy_len) {
      cpy_len = list_len;