OpenAtomFoundation / TobudOS

开放原子开源基金会孵化的物联网操作系统,捐赠前为腾讯物联网终端操作系统TencentOS Tiny
https://cloud.tencent.com/product/tos-tiny
5.97k stars 1.61k forks source link

[HUST CSE] Fix: 字符数组str越界 #369

Closed 7YZ7 closed 1 year ago

7YZ7 commented 1 year ago

为什么提交这份PR (why to submit this PR) 在board/TencentOS_Tiny_EVB_STM32WL/KEIL/lorawan_pm25/App/mqtt_iot_explorer_esp8266.c这个文件中,第68行创建的字符数组str大小只有16,后续后续148sprintf的字符串超出了16的大小,会发生数组越界,出现问题

你的解决方案是什么 (what is your solution) 将str字符数组开大空间,字符串"PM2.5:%4d ug/m3"包含结束符的长度为17,因此开辟32的空间则可以保证不越界

在什么测试环境下测试通过 (what is the test environment) 只增加了str的空间,因此测试一定会通过

]

tencent-adm commented 1 year ago

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.