803 Star 2.4K Fork 1.2K

GVPHuawei LiteOS / LiteOS

 / 详情

[Bug report] lead to buffer overflow

已完成
创建于  
2021-01-06 06:42

该问题是怎么引起的?

The function coap_parse_message() is used to parse coap packet. When avoiding code duplication without function overhead, it traverses the memory pointed by the pointer current_option, but the while loop does not check if reaches the end of the memory range as shown in https://gitee.com/LiteOS/LiteOS/blob/master/components/connectivity/lwm2m/core/er-coap-13/er-coap-13.c?_from=gitee_search#L732. This will lead to a buffer overflow.

重现步骤

Run the lwm2m demo project under client mode.
The repo is forbidden from uploading files and please leave an email to send the test packets.

报错信息

Due to the fact that lacking efficient error checking mechanism, the developer or tester needs to check this fault by debugging.

评论 (1)

SilentDawn 创建了任务
SilentDawn 关联仓库设置为LiteOS/LiteOS
展开全部操作日志

Basically, current_option is safe, current_option is checked firstly in line 699:
** while (current_option < data + data_len)**

and then in line 726, check current_option again:
** _ if (current_option + option_length > data + data_len)
{
PRINTF("OPTION %u (delta %u, len %u) has invalid length.\n", option_number, option_delta, option_length);
return BAD_REQUEST_4_00;
}_ **

bing 任务状态待办的 修改为已完成

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
C
1
https://gitee.com/LiteOS/LiteOS.git
git@gitee.com:LiteOS/LiteOS.git
LiteOS
LiteOS
LiteOS

搜索帮助