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

Fixed Pointer Comparison Error in Lines 824 and 847 of MFRC522Extended #640

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

vidura2
Copy link

@vidura2 vidura2 commented Oct 9, 2024

Description of Changes:

Issue:
    The error occurred due to an incorrect comparison between a pointer (backLen) and an integer (0), leading to a compilation error. In C++, pointer comparisons should be done carefully to avoid unintended behavior. Specifically, comparing a pointer directly to an integer caused the following error:
        Error message: ordered comparison of pointer with integer zero ('byte*' {aka 'unsigned char*'} and 'int')
        This occurred on lines 824 and 847, where backLen was incorrectly compared as a pointer instead of properly checking its dereferenced value or using an appropriate condition.
Fix:
    Replaced the invalid comparison by ensuring the comparison is done correctly. The condition now checks the correct value type to avoid comparing a pointer to an integer. Specifically, the code was updated to check backData for null and backLen as an integer:

    cpp

    if (backData && backLen && (*backLen > 0)) {

    This ensures that the pointer is valid and that the value it points to is greater than 0, preventing the compilation error and ensuring correct behavior.

Impact of Changes:

Fixed compilation errors related to pointer comparisons.
Ensured proper handling of RFID communication data, which leads to improved stability in operations using the MFRC522Extended library.

@fpindej
Copy link

fpindej commented Oct 10, 2024

Would it be possible to get this one merged please? 🙏🏻 It seems to be generally known and re-occurring issue.

@vidura2
Copy link
Author

vidura2 commented Oct 11, 2024

just check my repo I have forked this repo

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.

2 participants