nfctype1: Use the right offset after the CC
authorSamuel Ortiz <sameo@linux.intel.com>
Mon, 19 Aug 2013 14:40:59 +0000 (16:40 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 19 Aug 2013 14:40:59 +0000 (16:40 +0200)
The Capability container is 4 bytes long and the NDEF data can be found
right after that. The offset for the static memory on a dynamic tag
should thus be the length of the CC and not more.

plugins/nfctype1.c

index 553f0e0..c1469c1 100644 (file)
@@ -200,7 +200,6 @@ static int read_dynamic_tag(uint8_t *cc, int length, void *data)
 {
        struct type1_tag *t1_tag = data;
        struct type1_cmd t1_cmd;
-
        uint8_t *tagdata;
        uint8_t *pndef;
        size_t data_length;
@@ -209,10 +208,8 @@ static int read_dynamic_tag(uint8_t *cc, int length, void *data)
 
        tagdata = near_tag_get_data(t1_tag->tag, &data_length);
 
-       /* Skip un-needed bytes */
+       /* Skip capability container bytes  */
        pndef = cc + 4;         /* right after CC bytes */
-       pndef = pndef + 5;      /* skip TLV Lock bits bytes */
-       pndef = pndef + 5;      /* skip TLV ControlIT bytes */
 
        /*
         * Save first NFC bytes to tag memory
@@ -242,7 +239,6 @@ static int meta_recv(uint8_t *resp, int length, void *data)
        struct t1_cookie *cookie = data;
        struct near_tag *tag;
        struct type1_tag *t1_tag;
-
        uint8_t *cc;
        int err = -EOPNOTSUPP;