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

Commit 8f013f79 authored by Hui Peng's avatar Hui Peng
Browse files

Fix an OOB bug in gatt_dbg_op_name

Bug: 260079141
Test: manual
Ignore-AOSP-First: security
Change-Id: If8be70e134fdf1f6edb43d0360c524fffed6045b
parent d0fc4262
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1630,10 +1630,12 @@ uint8_t* gatt_dbg_op_name(uint8_t op_code) {
    pseduo_op_code_idx = 0x15; /* just an index to op_code_name */
  }

  if (pseduo_op_code_idx <= GATT_OP_CODE_MAX)
  #define ARR_SIZE(a) (sizeof(a)/sizeof(a[0]))
  if (pseduo_op_code_idx < ARR_SIZE(op_code_name))
    return (uint8_t*)op_code_name[pseduo_op_code_idx];
  else
    return (uint8_t*)"Op Code Exceed Max";
  #undef ARR_SIZE
}

/** Remove the application interface for the specified background device */