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

Commit 7c6e1187 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Andre Eisenbach
Browse files

Fix crash on GATT service unregistration

When SDP_MAX_RECORDS were reached in SDP db, which usually happen by
registering big number of GATT services, unregistration of a service was
causing a crash. This was because we moved from memory after the array
into last element.

Bug: 38265174
Test: manual
Change-Id: I7b0235213fb07c85dcc1245f1c840b41267521d5
(cherry picked from commit cac6fc59)
parent 96f69ca1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -312,7 +312,7 @@ bool SDP_DeleteRecord(uint32_t handle) {
    for (xx = 0; xx < sdp_cb.server_db.num_records; xx++, p_rec++) {
      if (p_rec->record_handle == handle) {
        /* Found it. Shift everything up one */
        for (yy = xx; yy < sdp_cb.server_db.num_records; yy++, p_rec++) {
        for (yy = xx; yy < sdp_cb.server_db.num_records - 1; yy++, p_rec++) {
          *p_rec = *(p_rec + 1);

          /* Adjust the attribute value pointer for each attribute */