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.
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;
}_ **
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
登录 后才可以发表评论