mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 22:14:04 +02:00
nfc: pn533: prevent potential memory corruption
[ Upstream commitca4d4c34ae] If the "type_a->nfcid_len" is too large then it would lead to memory corruption in pn533_target_found_type_a() when we do: memcpy(nfc_tgt->nfcid1, tgt_type_a->nfcid_data, nfc_tgt->nfcid1_len); Fixes:c3b1e1e8a7("NFC: Export NFCID1 from pn533") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
a16f02187d
commit
db574a60c4
|
|
@ -706,6 +706,9 @@ static bool pn533_target_type_a_is_valid(struct pn533_target_type_a *type_a,
|
||||||
if (PN533_TYPE_A_SEL_CASCADE(type_a->sel_res) != 0)
|
if (PN533_TYPE_A_SEL_CASCADE(type_a->sel_res) != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (type_a->nfcid_len > NFC_NFCID1_MAXSIZE)
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user