diff options
| author | CXSforHPU <[email protected]> | 2026-11-30 22:35:52 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2026-12-01 10:43:59 +0800 |
| commit | fbdb9711db8be41fe84f92a2f983c048c11f9a47 (patch) | |
| tree | 3c5a0b9a39b1c67ab40ef20c55626dc621d8997b /components/net/lwip-2.0.2/src/apps/snmp | |
| parent | 75b53af8ccd14047b836488869e75a3f0be27f4e (diff) | |
rt_sfud_flash_probe_ex() 通过 rt_strncpy(dst, src, rt_strlen(src)) 复制两个
设备名。第三个参数表示的是源字符串长度,而不是目标缓冲区容量;且此时
strncpy() 不会复制结尾的 '\0',正确性依赖紧随其后的两行 "make string end
sign" 手工补终。当 rt_strncpy() 映射到 libc 内建实现时,GCC 会以
-Wstringop-overflow("specified bound depends on the length of the source
argument")报出该写法,对应 issue #6668。
改用 rt_strdup():一次性分配 strlen() + 1 字节并连同 '\0' 一起拷贝,因此删除
strncpy() 与手工补终。所有权不变:两个缓冲区仍交给 SFUD,由
rt_sfud_flash_delete() 以及本函数的错误路径通过 rt_free() 释放;rt_strdup()
分配失败返回 NULL,已有的判空逻辑已覆盖。
Fixes #6668
Diffstat (limited to 'components/net/lwip-2.0.2/src/apps/snmp')
0 files changed, 0 insertions, 0 deletions
