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

Commit 3ba6528f authored by Android Build Merger (Role)'s avatar Android Build Merger (Role)
Browse files

[automerger] Fix possible OOB read in process_service_search_rsp am:...

[automerger] Fix possible OOB read in process_service_search_rsp am: d5228d74 am: fa74823b am: b361611d

Change-Id: Ide25784c8161e3bf8e8bf19de71e810006a4ffd3
parents fefa934e b361611d
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -291,6 +291,11 @@ static void process_service_search_rsp(tCONN_CB *p_ccb, UINT8 *p_reply,
    UINT16      total, cur_handles, orig;
    UINT8       cont_len;

    if (p_reply + 8 > p_reply_end) {
        android_errorWriteLog(0x534e4554, "74249842");
        sdp_disconnect(p_ccb, SDP_GENERIC_ERROR);
        return;
    }
    /* Skip transaction, and param len */
    p_reply += 4;
    BE_STREAM_TO_UINT16 (total, p_reply);
@@ -311,6 +316,12 @@ static void process_service_search_rsp(tCONN_CB *p_ccb, UINT8 *p_reply,
    if (p_ccb->num_handles > sdp_cb.max_recs_per_search)
        p_ccb->num_handles = sdp_cb.max_recs_per_search;

    if (p_reply + ((p_ccb->num_handles - orig) * 4) + 1 > p_reply_end) {
        android_errorWriteLog(0x534e4554, "74249842");
        sdp_disconnect(p_ccb, SDP_GENERIC_ERROR);
        return;
    }

    for (xx = orig; xx < p_ccb->num_handles; xx++)
        BE_STREAM_TO_UINT32 (p_ccb->handles[xx], p_reply);