Skip to content

Commit 6491d69

Browse files
Dan Carpenterdavem330
authored andcommitted
nfc: nci: Potential off by one in ->pipes[] array
This is similar to commit e285d5b ("NFC: Fix the number of pipes") where we changed NFC_HCI_MAX_PIPES from 127 to 128. As the comment next to the define explains, the pipe identifier is 7 bits long. The highest possible pipe is 127, but the number of possible pipes is 128. As the code is now, then there is potential for an out of bounds array access: net/nfc/nci/hci.c:297 nci_hci_cmd_received() warn: array off by one? 'ndev->hci_dev->pipes[pipe]' '0-127 == 127' Fixes: 11f54f2 ("NFC: nci: Add HCI over NCI protocol support") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d7ee81a commit 6491d69

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/net/nfc/nci_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ struct nci_conn_info {
166166
* According to specification 102 622 chapter 4.4 Pipes,
167167
* the pipe identifier is 7 bits long.
168168
*/
169-
#define NCI_HCI_MAX_PIPES 127
169+
#define NCI_HCI_MAX_PIPES 128
170170

171171
struct nci_hci_gate {
172172
u8 gate;

0 commit comments

Comments
 (0)