]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/emv/tlv.c
Legic TagSim: increased reader timeout (#771)
[proxmark3-svn] / client / emv / tlv.c
index 540c33e4ceb19a427fe5764294e2ca311b293afd..35bdb5d4cca05d161fca1c54cef0b6c7afe862c0 100644 (file)
@@ -92,16 +92,15 @@ static size_t tlv_parse_len(const unsigned char **buf, size_t *len)
                return l;
 
        size_t ll = l &~ TLV_LEN_LONG;
-       if (*len < ll)
+       if (ll > 5)
                return TLV_LEN_INVALID;
 
-       /* FIXME */
-       if (ll != 1)
-               return TLV_LEN_INVALID;
-
-       l = **buf;
-       --*len;
-       ++*buf;
+       l = 0;
+       for (int i = 1; i <= ll; i++) {
+               l = (l << 8) + **buf;
+               --*len;
+               ++*buf;
+       }
 
        return l;
 }
Impressum, Datenschutz