]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
fix get length in tlv (#714)
authorOleg Moiseenko <807634+merlokk@users.noreply.github.com>
Sat, 17 Nov 2018 17:04:25 +0000 (19:04 +0200)
committerpwpiwi <pwpiwi@users.noreply.github.com>
Sat, 17 Nov 2018 17:04:25 +0000 (19:04 +0200)
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;
                return l;
 
        size_t ll = l &~ TLV_LEN_LONG;
-       if (*len < ll)
+       if (ll > 5)
                return TLV_LEN_INVALID;
 
                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;
 }
 
        return l;
 }
Impressum, Datenschutz