Skip to content

Conversation

@iabdalkader
Copy link
Contributor

vsprintf should be avoided as it could easily overflow the buffer if the formatted string exceeds the max buffer size. vsnprintf, on the other hand, checks a buffer size argument. Note that they both null-terminate the string, so calling memset beforehand is not necessary.

`vsprintf` should be avoided as it could easily overflow the buffer if the formatted
string exceeds the max buffer size. `vsnprintf`, on the other hand, checks a buffer
size argument. Note that they both null-terminate the string, so calling `memset`
beforehand is not necessary.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
@iabdalkader iabdalkader requested review from facchinm and pennam May 15, 2024 08:10
@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels May 15, 2024
@iabdalkader iabdalkader merged commit 8d3bb27 into arduino:main May 16, 2024
@iabdalkader iabdalkader deleted the vsprintf_buffer_overflows branch May 16, 2024 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants