-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Potential fix for code scanning alert no. 75: Use of potentially dangerous function #11702
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
Conversation
…e function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
… write Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
… write Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…erous function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…erous function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…erous function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
👋 Hello lucasssvaz, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
|
Potential fix for https://github.com/espressif/arduino-esp32/security/code-scanning/75
To fix the problem, replace calls to
localtime
with the thread-safe variantlocaltime_r
. This requires allocating astruct tm
on the stack and passing its address tolocaltime_r
, which fills in the structure and returns a pointer to it. Specifically, inlistDir
, replace both instances ofstruct tm *tmstruct = localtime(&t);
(lines 81 and 95) with code that declares astruct tm tmstruct;
and callslocaltime_r(&t, &tmstruct);
. Then, use&tmstruct
in place oftmstruct
in the subsequent code. No additional imports are needed, as<time.h>
is already included.Suggested fixes powered by Copilot Autofix. Review carefully before merging.