NTAG424DNA - ChangeFileSettingsSDM NULL consistency / Don't append non-flagged bytes

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NTAG424DNA - ChangeFileSettingsSDM NULL consistency / Don't append non-flagged bytes

499 Views
eljeffo
Contributor III

In NxpNfcRdLib/comps/phalMfNtag42XDna/src/Sw/phalMfNtag42XDna_Sw.c

There is a line for phalMfNtag42XDna_Sw_ChangeFileSettingsSDM that reads:

    if(pSDMENCLen > 0)

For consistency it should be 

    if(pSDMENCLen != NULL)

 

Also would suggest that != NULL is insufficient as a check.  Bytes should only be appended if both A) SdmOptions has the proper bit flag set and B) the pointer to the matching data array is not NULL. 

This leads to malformed messages when data is provided and the flag is not set.

This also means that users of the SDK require more logic in the application side than necessary, forcing users to NULL out pointers when a simple bit-clear would be sufficient as an indicator of non-use.

Labels (1)
0 Kudos
1 Reply

477 Views
KellyLi
NXP TechSupport
NXP TechSupport

Hello,

When this API is called for somewhere, this variable has been asserted it is a NULL or not , so it is reasonable to judge the input paramerters like this inside function.

Best Regards,

Thanks!

kelly

0 Kudos