ANDROID: NFC: st21nfca: Fix out of bounds kernel access when handling ATR_REQ
Out of bounds kernel accesses in st21nfca's NFC HCI layer might happen when handling ATR_REQ events if user-specified atr_req->length is bigger than the buffer size. In that case memcpy() inside st21nfca_tm_send_atr_res() will read extra bytes resulting in OOB read from the kernel heap. Bug: 62679012 Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
parent
9d30b77414
commit
51d5daea85
1 changed files with 2 additions and 1 deletions
|
@ -217,7 +217,8 @@ static int st21nfca_tm_recv_atr_req(struct nfc_hci_dev *hdev,
|
|||
|
||||
atr_req = (struct st21nfca_atr_req *)skb->data;
|
||||
|
||||
if (atr_req->length < sizeof(struct st21nfca_atr_req)) {
|
||||
if (atr_req->length < sizeof(struct st21nfca_atr_req) ||
|
||||
atr_req->length > skb->len) {
|
||||
r = -EPROTO;
|
||||
goto exit;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue