mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-13 10:43:01 +08:00
fix tlv.c
This commit is contained in:
parent
5e3fa42c23
commit
46769838f2
1 changed files with 7 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue