Fix SDP integer overflow and inverted NULL check in gatt_db clone#15
Fix SDP integer overflow and inverted NULL check in gatt_db clone#15TuNaiChao wants to merge 2 commits into
Conversation
gatt_db_clone() returns NULL on failure. The old condition bailed out early on a successful clone and fell through on failure, dereferencing a NULL pointer a few lines below. 适配v25系统,修复gatt_db克隆时NULL检查逻辑反转的问题 gatt_db_clone() 在失败时返回 NULL,原条件判断逻辑反转:克隆成功 (非NULL)时反而提前返回并跳过设备 GATT 数据库的交换,克隆失败 (NULL)时却继续向下执行,导致后续解引用空指针。修复为仅在克隆 失败时才提前返回,克隆成功时正常进行数据库交换。
|
TAG Bot TAG: 5.85-3deepin8 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @TuNaiChao. Thanks for your PR. I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
size value read from the packet was directly assigned to an int without range checking. A crafted SDP packet with a size exceeding INT_MAX would overflow the int, leading to a wrong/negative size value and potential out-of-bounds access during parsing. 适配v25系统,修复SDP解析中sdp_extract_seqtype整数溢出的问题 从数据包读取的 uint32_t size 值被直接赋值给 int 类型的 *size, 未做范围检查。当恶意构造的 SDP 数据包 size 超过 INT_MAX 时会 导致整数溢出,得到错误或负数的 size 值,可能在后续解析过程中 引发越界访问。修复为在赋值前校验 uint32_t 值不超过 INT_MAX, 超限时返回错误,避免溢出。
Fix SDP integer overflow and inverted NULL check in gatt_db clone
适配v25系统,修复SDP解析整数溢出与gatt_db克隆NULL检查反转的问题
修复 sdp_extract_seqtype() 中的整数溢出:
从数据包读取的 uint32_t size 值被直接赋值给 int 类型的 *size,
未做范围检查。恶意构造的 SDP 数据包 size 超过 INT_MAX 时会
导致整数溢出,得到错误或负数的 size 值,可能在后续解析过程中
引发越界访问。修复为在赋值前校验 uint32_t 值不超过 INT_MAX,
超限时返回错误,避免溢出。
Fixed integer overflow in sdp_extract_seqtype() where the uint32_t
size value read from the packet was directly assigned to an int
without range checking. A crafted SDP packet with a size exceeding
INT_MAX would overflow the int, leading to a wrong/negative size
value and potential out-of-bounds access during parsing.
修复 btd_device_set_gatt_db() 中的 NULL 检查逻辑反转:
gatt_db_clone() 在失败时返回 NULL,原条件判断逻辑反转:克隆成功
(非NULL)时反而提前返回并跳过设备 GATT 数据库的交换,克隆失败
(NULL)时却继续向下执行,导致后续解引用空指针。修复为仅在克隆
失败时才提前返回,克隆成功时正常进行数据库交换。
Fixed inverted NULL check in btd_device_set_gatt_db() since
gatt_db_clone() returns NULL on failure. The old condition bailed
out early on a successful clone and fell through on failure,
dereferencing a NULL pointer a few lines below.