• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


コミットメタ情報

リビジョン5dd354b8c5664c69d13180baa2145411888bdedf (tree)
日時2019-02-13 06:10:31
作者Hansong Zhang <hsz@goog...>
コミッターJP Sugarbroad

ログメッセージ

DO NOT MERGE process_l2cap_cmd: Fix OOB

Bug: 119870451
Test: POC
Change-Id: Ieef322a3ad4cebcaf40e5388584d3a04a4761d2e
(cherry picked from commit 38f07a3c93143ca31229f0caa5b1a270dc1f5401)

変更サマリ

差分

--- a/stack/l2cap/l2c_main.c
+++ b/stack/l2cap/l2c_main.c
@@ -490,7 +490,11 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
490490 {
491491 case L2CAP_CFG_TYPE_MTU:
492492 cfg_info.mtu_present = TRUE;
493- if (p + 2 > p_next_cmd) {
493+ if (cfg_len != 2) {
494+ android_errorWriteLog(0x534e4554, "119870451");
495+ return;
496+ }
497+ if (p + cfg_len > p_next_cmd) {
494498 android_errorWriteLog(0x534e4554, "74202041");
495499 return;
496500 }
@@ -499,7 +503,11 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
499503
500504 case L2CAP_CFG_TYPE_FLUSH_TOUT:
501505 cfg_info.flush_to_present = TRUE;
502- if (p + 2 > p_next_cmd) {
506+ if (cfg_len != 2) {
507+ android_errorWriteLog(0x534e4554, "119870451");
508+ return;
509+ }
510+ if (p + cfg_len > p_next_cmd) {
503511 android_errorWriteLog(0x534e4554, "74202041");
504512 return;
505513 }
@@ -508,7 +516,11 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
508516
509517 case L2CAP_CFG_TYPE_QOS:
510518 cfg_info.qos_present = TRUE;
511- if (p + 2 + 5 * 4 > p_next_cmd) {
519+ if (cfg_len != 2 + 5 * 4) {
520+ android_errorWriteLog(0x534e4554, "119870451");
521+ return;
522+ }
523+ if (p + cfg_len > p_next_cmd) {
512524 android_errorWriteLog(0x534e4554, "74202041");
513525 return;
514526 }
@@ -523,7 +535,11 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
523535
524536 case L2CAP_CFG_TYPE_FCR:
525537 cfg_info.fcr_present = TRUE;
526- if (p + 3 + 3 * 2 > p_next_cmd) {
538+ if (cfg_len != 3 + 3 * 2) {
539+ android_errorWriteLog(0x534e4554, "119870451");
540+ return;
541+ }
542+ if (p + cfg_len > p_next_cmd) {
527543 android_errorWriteLog(0x534e4554, "74202041");
528544 return;
529545 }
@@ -537,7 +553,11 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
537553
538554 case L2CAP_CFG_TYPE_FCS:
539555 cfg_info.fcs_present = TRUE;
540- if (p + 1 > p_next_cmd) {
556+ if (cfg_len != 1) {
557+ android_errorWriteLog(0x534e4554, "119870451");
558+ return;
559+ }
560+ if (p + cfg_len > p_next_cmd) {
541561 android_errorWriteLog(0x534e4554, "74202041");
542562 return;
543563 }
@@ -546,7 +566,11 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
546566
547567 case L2CAP_CFG_TYPE_EXT_FLOW:
548568 cfg_info.ext_flow_spec_present = TRUE;
549- if (p + 2 + 2 + 3 * 4 > p_next_cmd) {
569+ if (cfg_len != 1 + 2 + 3 * 4) {
570+ android_errorWriteLog(0x534e4554, "119870451");
571+ return;
572+ }
573+ if (p + cfg_len > p_next_cmd) {
550574 android_errorWriteLog(0x534e4554, "74202041");
551575 return;
552576 }
--- a/stack/l2cap/l2c_utils.c
+++ b/stack/l2cap/l2c_utils.c
@@ -859,6 +859,9 @@ void l2cu_send_peer_config_rej (tL2C_CCB *p_ccb, UINT8 *p_data, UINT16 data_len,
859859 case L2CAP_CFG_TYPE_MTU:
860860 case L2CAP_CFG_TYPE_FLUSH_TOUT:
861861 case L2CAP_CFG_TYPE_QOS:
862+ case L2CAP_CFG_TYPE_FCR:
863+ case L2CAP_CFG_TYPE_FCS:
864+ case L2CAP_CFG_TYPE_EXT_FLOW:
862865 p_data += cfg_len + L2CAP_CFG_OPTION_OVERHEAD;
863866 break;
864867