moreira / NFCIsoDepListener

0 stars 0 forks source link

Wrong NDef message handling #2

Open ch4k4uw opened 16 hours ago

ch4k4uw commented 16 hours ago

You have the following line at your APDU parser method: https://github.com/moreira/NFCIsoDepListener/blob/e4fde3e0e0431f7554fe6e2f0fad93ef612d2453/app/src/main/java/com/example/nfcisodeplistener/APDUCommand.java#L62

I got some errors when using your app to parse the NDef message sent by my app. But your app worked properly when I removed that -1 of your apdu.length-1 algorithm.

Please consider the following APDU extended command to simulate this issue:

00d60000000097d1019355007069783a2f2f6369656c6f2e636f6d2e62723f71723d303030323031323633363030313442522e474f562e4243422e504958303131342b35353134393932343536303932353230343030303035333033393836353430363130302e303035383032425235393131506564726f204d6f7474613630303953616f205061756c6f36323037303530332a2a2a3633303438413341

This APDU encapsulates the following URI:

pix://cielo.com.br?qr=00020126360014BR.GOV.BCB.PIX0114+55149924560925204000053039865406100.005802BR5911Pedro Motta6009Sao Paulo62070503***63048A3A

Thanks!

pmotta

moreira commented 6 hours ago

Instead of just removing the hardcoded -1 (it was there because of Le field) from the array copy, I used the declared data length to calculate how many bytes I should copy.