linux/net/nfc
Ömer Mete Kaya 7dcf371a35
nfc: llcp: fix slab-out-of-bounds reads when logging service names
nfc_llcp_wks_sap() and nfc_llcp_build_sdreq_tlv() pass non-null-
terminated strings to pr_debug() using the %s format specifier.
The buffers are allocated via kmemdup() or come from netlink
attributes and are not guaranteed to be null-terminated, causing
__dynamic_pr_debug() to read beyond the allocated region:

  KASAN: slab-out-of-bounds Read in __dynamic_pr_debug

Fix both call sites by using %.*s with the explicit length to limit
the output to the actual length of the string.

Fixes: d9b8d8e19b ("NFC: llcp: Service Name Lookup netlink interface")
Reported-by: syzbot+1e3df0852e82c21ca418@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1e3df0852e82c21ca418
Signed-off-by: Ömer Mete Kaya <omermetekaya0@gmail.com>
Link: https://patch.msgid.link/20260908161952.731468-1-omermetekaya0@gmail.com
Signed-off-by: David Heidelberg <david@ixit.cz>
2026-09-23 22:13:17 +02:00
..
hci nfc: hci: fix out-of-bounds read in HCP header parsing 2026-05-07 12:42:09 +02:00
nci nfc: fix use-after-free in nfc_get_local_general_bytes 2026-09-23 22:13:17 +02:00
af_nfc.c nfc: fix error handling of nfc_proto_register() 2021-10-13 17:32:38 -07:00
core.c nfc: fix use-after-free in nfc_get_local_general_bytes 2026-09-23 22:13:17 +02:00
digital_core.c nfc: digital: Do not dump a NULL response in command completion 2026-08-11 18:10:03 +02:00
digital_dep.c nfc: fix use-after-free in nfc_get_local_general_bytes 2026-09-23 22:13:17 +02:00
digital_technology.c nfc: digital: clamp SENSF_RES length to the destination buffer 2026-08-11 18:10:02 +02:00
digital.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
Kconfig net: remove redundant 'depends on NET' 2021-01-27 17:04:12 -08:00
llcp_commands.c nfc: llcp: fix slab-out-of-bounds reads when logging service names 2026-09-23 22:13:17 +02:00
llcp_core.c nfc: llcp: fix slab-out-of-bounds reads when logging service names 2026-09-23 22:13:17 +02:00
llcp_sock.c nfc: llcp: fix -ENOMEM on connect with zero-length service name 2026-09-23 22:13:17 +02:00
llcp.h nfc: llcp: Fix race condition in accept_queue lifecycle 2026-09-23 22:13:16 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
netlink.c nfc: llcp: fix sdreq TLV list leak on parse/alloc/send failure 2026-09-23 22:13:17 +02:00
nfc.h nfc: fix use-after-free in nfc_get_local_general_bytes 2026-09-23 22:13:17 +02:00
rawsock.c nfc: rawsock: cancel tx_work before socket teardown 2026-03-04 18:18:57 -08:00