In the Linux kernel, the following vulnerability has been resolved:
nfc: llcp: fix OOB read and u8 offset wrap in TLV parsers
nfcllcpparsegbtlv() and nfcllcpparseconnectiontlv() contain three related bugs in their TLV parsing loops:
'offset' is declared u8 but tlvarraylen is u16. When TLV data advances offset past 255 it silently wraps to zero, causing infinite loops or double-processing of buffer data.
Before reading tlv[0] (type) and tlv[1] (length) there is no check that offset+2 <= tlvarraylen. A truncated TLV causes an OOB read of one byte past the buffer end.
After reading the length field, the value bytes are accessed without checking offset+2+length <= tlvarraylen. A crafted length=0xFF on a short buffer causes up to 255 bytes of OOB read past the buffer end.
Both functions are reachable without authentication via nfcllcpsetremotegb() which feeds remote LLCP general bytes directly into nfcllcpparsegbtlv() with no additional validation.
Fix all three issues by widening offset from u8 to u16 and adding bounds checks for both the TLV header and value field before each access.