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

log_printf may cause memory leak and unexpected behaviour #6360

Merged
merged 1 commit into from
Mar 2, 2022
Merged

log_printf may cause memory leak and unexpected behaviour #6360

merged 1 commit into from
Mar 2, 2022

Conversation

BlueAndi
Copy link
Contributor

Summary

Traversing a variable argument list twice may cause unexpected behaviour. Therefore the variable argument list 'arg' is copied to 'copy'. Unfortunately in line 484 'copy' is not used to retrieve the length, but 'arg'.
Additional if the retrieved length is greater or equal than the available buffer, the clean-up of the variable argument list 'arg' is missing.

Impact

This may cause unexpected and compiler dependend behaviour, because 'arg' is used in line some lines below again.
The missing clean-up of the variable argument list may lead to a memory leak, but depends on the compiler.

… to retrieve length. If length is greater or equal than the available buffer, a memory leak will happen because va_end() is missing.
@me-no-dev me-no-dev merged commit 4da1051 into espressif:master Mar 2, 2022
@me-no-dev
Copy link
Member

Thanks @BlueAndi :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants