-
Notifications
You must be signed in to change notification settings - Fork 0
NFC: Add write support for the password-protected MF ultralight tag #338
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -375,8 +375,7 @@ static NfcCommand mf_ultralight_poller_handler_read_tearing_flags(MfUltralightPo | |
| NfcCommand command = NfcCommandContinue; | ||
|
|
||
| if(mf_ultralight_support_feature( | ||
| instance->feature_set, | ||
| MfUltralightFeatureSupportCheckTearingFlag | MfUltralightFeatureSupportSingleCounter)) { | ||
| instance->feature_set, MfUltralightFeatureSupportCheckTearingFlag)) { | ||
| if(instance->tearing_flag_read == instance->tearing_flag_total) { | ||
| instance->state = MfUltralightPollerStateTryDefaultPass; | ||
| command = NfcCommandReset; | ||
|
|
@@ -437,7 +436,11 @@ static NfcCommand mf_ultralight_poller_handler_auth(MfUltralightPoller* instance | |
| } | ||
| } | ||
| } | ||
| instance->state = MfUltralightPollerStateReadPages; | ||
| if(instance->mode == MfUltralightPollerModeRead) { | ||
| instance->state = MfUltralightPollerStateReadPages; | ||
| } else { | ||
| instance->state = MfUltralightPollerStateRequestWriteData; | ||
|
Comment on lines
+439
to
+442
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
After the auth handler now branches directly to Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| return command; | ||
| } | ||
|
|
@@ -678,14 +681,8 @@ static NfcCommand mf_ultralight_poller_handler_read_success(MfUltralightPoller* | |
| FURI_LOG_D(TAG, "Read success"); | ||
| instance->mfu_event.type = MfUltralightPollerEventTypeReadSuccess; | ||
| NfcCommand command = instance->callback(instance->general_event, instance->context); | ||
|
|
||
| if(instance->mode == MfUltralightPollerModeRead) { | ||
| iso14443_3a_poller_halt(instance->iso14443_3a_poller); | ||
| instance->state = MfUltralightPollerStateIdle; | ||
| } else { | ||
| instance->state = MfUltralightPollerStateRequestWriteData; | ||
| } | ||
|
|
||
| iso14443_3a_poller_halt(instance->iso14443_3a_poller); | ||
| instance->state = MfUltralightPollerStateIdle; | ||
| return command; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a potential
NULLpointer dereference here. The functionmf_ultralight_get_config_pagereturns aboolindicating success or failure, but its return value is not checked. If it returnsfalse, theconfigpointer will remainNULL, leading to a crash whenconfig->auth0is accessed.You should check the return value of
mf_ultralight_get_config_pageand also ensureconfigis notNULLbefore dereferencing it. The suggested change incorporates these checks into theifcondition, ensuring that authentication is skipped if the configuration page cannot be retrieved.