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

tftp 读取文件文件名为特定长度 会导致程序崩溃 #91

Open
xkf321 opened this issue Nov 29, 2022 · 2 comments
Open

tftp 读取文件文件名为特定长度 会导致程序崩溃 #91

xkf321 opened this issue Nov 29, 2022 · 2 comments

Comments

@xkf321
Copy link

xkf321 commented Nov 29, 2022

如果读取slin.log.0, erpc.log.0 程序会崩溃 ,读取文件名为module.log.0 程序正常

调试后发现内存分配长度没有考虑\0, 由于malloc分配以字节对齐方式分配,当文件名不是对齐字节长度的整数倍,malloc会多分配一些字节以保证内存对齐,某些文件名长度正好是整数倍时,出现内存越界,导致程序崩溃

图片

@xkf321
Copy link
Author

xkf321 commented Nov 29, 2022

图片

@armink
Copy link
Member

armink commented Nov 29, 2022

欢迎提交 PR 哈

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

2 participants