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

Commit b0f7015c authored by Hansong Zhang's avatar Hansong Zhang Committed by android-build-merger
Browse files

Merge "process_l2cap_cmd: Fix OOB" into oc-dev am: b72666cc

am: 65a1c786

Change-Id: I4f04fad60e84785f474390e473d2fcf19f66a044
parents c1a4fea4 65a1c786
Loading
Loading
Loading
Loading
+30 −6
Original line number Diff line number Diff line
@@ -469,7 +469,11 @@ static void process_l2cap_cmd(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) {
          switch (cfg_code & 0x7F) {
            case L2CAP_CFG_TYPE_MTU:
              cfg_info.mtu_present = true;
              if (p + 2 > p_next_cmd) {
              if (cfg_len != 2) {
                android_errorWriteLog(0x534e4554, "119870451");
                return;
              }
              if (p + cfg_len > p_next_cmd) {
                android_errorWriteLog(0x534e4554, "74202041");
                return;
              }
@@ -478,7 +482,11 @@ static void process_l2cap_cmd(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) {

            case L2CAP_CFG_TYPE_FLUSH_TOUT:
              cfg_info.flush_to_present = true;
              if (p + 2 > p_next_cmd) {
              if (cfg_len != 2) {
                android_errorWriteLog(0x534e4554, "119870451");
                return;
              }
              if (p + cfg_len > p_next_cmd) {
                android_errorWriteLog(0x534e4554, "74202041");
                return;
              }
@@ -487,7 +495,11 @@ static void process_l2cap_cmd(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) {

            case L2CAP_CFG_TYPE_QOS:
              cfg_info.qos_present = true;
              if (p + 2 + 5 * 4 > p_next_cmd) {
              if (cfg_len != 2 + 5 * 4) {
                android_errorWriteLog(0x534e4554, "119870451");
                return;
              }
              if (p + cfg_len > p_next_cmd) {
                android_errorWriteLog(0x534e4554, "74202041");
                return;
              }
@@ -502,7 +514,11 @@ static void process_l2cap_cmd(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) {

            case L2CAP_CFG_TYPE_FCR:
              cfg_info.fcr_present = true;
              if (p + 3 + 3 * 2 > p_next_cmd) {
              if (cfg_len != 3 + 3 * 2) {
                android_errorWriteLog(0x534e4554, "119870451");
                return;
              }
              if (p + cfg_len > p_next_cmd) {
                android_errorWriteLog(0x534e4554, "74202041");
                return;
              }
@@ -516,7 +532,11 @@ static void process_l2cap_cmd(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) {

            case L2CAP_CFG_TYPE_FCS:
              cfg_info.fcs_present = true;
              if (p + 1 > p_next_cmd) {
              if (cfg_len != 1) {
                android_errorWriteLog(0x534e4554, "119870451");
                return;
              }
              if (p + cfg_len > p_next_cmd) {
                android_errorWriteLog(0x534e4554, "74202041");
                return;
              }
@@ -525,7 +545,11 @@ static void process_l2cap_cmd(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) {

            case L2CAP_CFG_TYPE_EXT_FLOW:
              cfg_info.ext_flow_spec_present = true;
              if (p + 2 + 2 + 3 * 4 > p_next_cmd) {
              if (cfg_len != 2 + 2 + 3 * 4) {
                android_errorWriteLog(0x534e4554, "119870451");
                return;
              }
              if (p + cfg_len > p_next_cmd) {
                android_errorWriteLog(0x534e4554, "74202041");
                return;
              }
+3 −0
Original line number Diff line number Diff line
@@ -804,6 +804,9 @@ void l2cu_send_peer_config_rej(tL2C_CCB* p_ccb, uint8_t* p_data,
      case L2CAP_CFG_TYPE_MTU:
      case L2CAP_CFG_TYPE_FLUSH_TOUT:
      case L2CAP_CFG_TYPE_QOS:
      case L2CAP_CFG_TYPE_FCR:
      case L2CAP_CFG_TYPE_FCS:
      case L2CAP_CFG_TYPE_EXT_FLOW:
        p_data += cfg_len + L2CAP_CFG_OPTION_OVERHEAD;
        break;