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

Commit 96c76a94 authored by Hui Peng's avatar Hui Peng Committed by Android (Google) Code Review
Browse files

Merge changes I3f999d40,Ic807df3b into tm-dev

* changes:
  Add validation in sdp attr type and size in connection_handler.cc
  Add type and len field in sdp attr in SetUpSdp
parents 9f7427d7 08cb26e2
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -470,7 +470,9 @@ void ConnectionHandler::SdpCb(RawAddress bdaddr, SdpCallback cb,
        VLOG(1) << __PRETTY_FUNCTION__ << " Get Supported categories";
        tSDP_DISC_ATTR* sdp_attribute =
            sdp_->FindAttributeInRec(sdp_record, ATTR_ID_SUPPORTED_FEATURES);
        if (sdp_attribute != NULL) {
        if (sdp_attribute != NULL &&
            SDP_DISC_ATTR_TYPE(sdp_attribute->attr_len_type) == UINT_DESC_TYPE &&
            SDP_DISC_ATTR_LEN(sdp_attribute->attr_len_type) >= 2) {
          VLOG(1) << __PRETTY_FUNCTION__
                  << "Get Supported categories SDP ATTRIBUTES != null";
          uint16_t categories = sdp_attribute->attr_value.v.u16;
@@ -511,7 +513,9 @@ void ConnectionHandler::SdpCb(RawAddress bdaddr, SdpCallback cb,
        VLOG(1) << __PRETTY_FUNCTION__ << " Get Supported categories";
        tSDP_DISC_ATTR* sdp_attribute =
            sdp_->FindAttributeInRec(sdp_record, ATTR_ID_SUPPORTED_FEATURES);
        if (sdp_attribute != NULL) {
        if (sdp_attribute != NULL &&
            SDP_DISC_ATTR_TYPE(sdp_attribute->attr_len_type) == UINT_DESC_TYPE &&
            SDP_DISC_ATTR_LEN(sdp_attribute->attr_len_type) >= 2) {
          VLOG(1) << __PRETTY_FUNCTION__
                  << "Get Supported categories SDP ATTRIBUTES != null";
          uint16_t categories = sdp_attribute->attr_value.v.u16;
+2 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include "sdpdefs.h"
#include "avrcp_internal.h"
#include "avrcp_test_helper.h"
#include "connection_handler.h"
@@ -55,7 +56,7 @@ class AvrcpConnectionHandlerTest : public testing::Test {
    fake_features = {
        .p_next_attr = nullptr,
        .attr_id = 0,
        .attr_len_type = 0,
        .attr_len_type = (UINT_DESC_TYPE<<12) | 2,
        .attr_value = {.v = {.u16 = 0}},
    };