Skip to content
New issue

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

C/C++安全指南建议 #72

Open
ylqian1912 opened this issue Aug 12, 2022 · 2 comments
Open

C/C++安全指南建议 #72

ylqian1912 opened this issue Aug 12, 2022 · 2 comments

Comments

@ylqian1912
Copy link

1.6 【必须】不应当把用户可修改的字符串作为printf系列函数的“format”参数
如果用户可以控制字符串,则通过 %n %p 等内容,最坏情况下可以直接执行任意恶意代码。

在以下情况尤其需要注意: WIFI名,设备名……

错误:

snprintf(buf, sizeof(buf), wifi_name);
正确:

snprinf(buf, sizeof(buf), "%s", wifi_name); // 这里应该是 snprintf,少个 t

@honguangli
Copy link

honguangli commented Aug 12, 2022 via email

@goexc
Copy link

goexc commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants