summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2023-10-11 09:31:44 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2023-10-13 20:06:33 -0700
commitcb3871b1cd135a6662b732fbc6b3db4afcdb4a64 (patch)
treef4e8dd8b980bc0db25584aa38626127c1ff20183 /ipc
parent9d1a3c74746428102d55371fbf74b484733937d9 (diff)
downloadlinux-stable-cb3871b1cd135a6662b732fbc6b3db4afcdb4a64.tar.gz
linux-stable-cb3871b1cd135a6662b732fbc6b3db4afcdb4a64.tar.bz2
linux-stable-cb3871b1cd135a6662b732fbc6b3db4afcdb4a64.zip
Bluetooth: hci_sock: Correctly bounds check and pad HCI_MON_NEW_INDEX name
The code pattern of memcpy(dst, src, strlen(src)) is almost always wrong. In this case it is wrong because it leaves memory uninitialized if it is less than sizeof(ni->name), and overflows ni->name when longer. Normally strtomem_pad() could be used here, but since ni->name is a trailing array in struct hci_mon_new_index, compilers that don't support -fstrict-flex-arrays=3 can't tell how large this array is via __builtin_object_size(). Instead, open-code the helper and use sizeof() since it will work correctly. Additionally mark ni->name as __nonstring since it appears to not be a %NUL terminated C string. Cc: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Cc: Edward AD <twuufnxlz@gmail.com> Cc: Marcel Holtmann <marcel@holtmann.org> Cc: Johan Hedberg <johan.hedberg@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Eric Dumazet <edumazet@google.com> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Paolo Abeni <pabeni@redhat.com> Cc: linux-bluetooth@vger.kernel.org Cc: netdev@vger.kernel.org Fixes: 18f547f3fc07 ("Bluetooth: hci_sock: fix slab oob read in create_monitor_event") Link: https://lore.kernel.org/lkml/202310110908.F2639D3276@keescook/ Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'ipc')
0 files changed, 0 insertions, 0 deletions