We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ef_log.c 文件内的 log_index2addr 函数使用存在隐藏风险,建议可以优化
ef_log.c
log_index2addr
当给 log_index2addr 传入的参数index 的值 大于 2倍LOG_AREA_SIZE时,回导致计算出来的flash物理地址错误
index
LOG_AREA_SIZE
建议将返回值计算 return log_start_addr + index + header_total_offset - LOG_AREA_SIZE; 修改为 return (log_start_addr + index + header_total_offse)t % LOG_AREA_SIZE;
return log_start_addr + index + header_total_offset - LOG_AREA_SIZE;
return (log_start_addr + index + header_total_offse)t % LOG_AREA_SIZE;
尽管此函数仅由ef_log_read调用,且ef_log_read函数内做了EF_ASSERT(index < cur_using_size);判断,目前整体是安全的,但是此函数是不安全的,为防止后续其他函数调用是引入风险,建议修改
ef_log_read
EF_ASSERT(index < cur_using_size);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
ef_log.c
文件内的log_index2addr
函数使用存在隐藏风险,建议可以优化当给
log_index2addr
传入的参数index
的值 大于 2倍LOG_AREA_SIZE
时,回导致计算出来的flash物理地址错误建议将返回值计算
return log_start_addr + index + header_total_offset - LOG_AREA_SIZE;
修改为
return (log_start_addr + index + header_total_offse)t % LOG_AREA_SIZE;
尽管此函数仅由
ef_log_read
调用,且ef_log_read
函数内做了EF_ASSERT(index < cur_using_size);
判断,目前整体是安全的,但是此函数是不安全的,为防止后续其他函数调用是引入风险,建议修改The text was updated successfully, but these errors were encountered: