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

Fix potential memcpy call with null dest #78

Conversation

emaxx-google
Copy link
Contributor

Add a check into CCID_Receive() in commands.c that skips calling
memcpy() in case the count is zero. This fixes the (theoretical) problem
in case both the count and the dest pointer are zero (such a call can be
made, e.g., from CmdXfrBlockAPDU_extended()) and the compiler uses the
non-null argument requirement to generate some incorrect code.

This potential issue was found by clang-tidy (the "NonNullParamChecker"
diagnostic).

Add a check into CCID_Receive() in commands.c that skips calling
memcpy() in case the count is zero. This fixes the (theoretical) problem
in case both the count and the dest pointer are zero (such a call can be
made, e.g., from CmdXfrBlockAPDU_extended()) and the compiler uses the
non-null argument requirement to generate some incorrect code.

This potential issue was found by clang-tidy (the
"NonNullParamChecker" diagnostic).
@LudovicRousseau
Copy link
Owner

Merged.
Thanks Maksim

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