dtc/libfdt
Oleksii Kurochko f57e7df35d libfdt: fix UBSAN null pointer in fdt_property()
fdt_property() unconditionally calls memcpy(ptr, val, len) even when
len is zero and val is NULL.  This is a legitimate calling convention
for adding empty FDT properties such as "interrupt-controller", which
carry no payload.

However, compilers that treat memcpy as nonnull on its pointer arguments
will fire UBSAN before observing that len is zero.

Guard the memcpy() with a check on len so it is skipped entirely when
there is no payload to copy, bringing the code in line with the
nonnull contract.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2026-05-20 11:35:03 +10:00
..
.gitignore Link tools and tests against libfdt shared library 2019-03-29 17:20:16 +11:00
fdt.c libfdt: Verify alignment of sub-blocks in dtb 2026-01-28 12:14:09 +11:00
fdt.h Use __ASSEMBLER__ instead of __ASSEMBLY__ 2025-03-14 13:51:31 +11:00
fdt_addresses.c libfdt: fix an incorrect integer promotion 2021-11-17 12:22:53 +11:00
fdt_check.c libfdt: fdt_check_full: Handle FDT_NOP when FDT_END is expected 2026-03-04 19:26:24 +11:00
fdt_empty_tree.c libfdt: Replace GPL/BSD boilerplate/reference with SPDX tags 2019-06-21 21:06:10 +10:00
fdt_overlay.c Fix discarded const qualifiers 2026-01-10 18:55:38 +11:00
fdt_ro.c libfdt: Fix bugs with unchecked usage of fdt_num_mem_rsv() 2026-04-17 21:21:16 +10:00
fdt_rw.c libfdt: Fix bugs with unchecked usage of fdt_num_mem_rsv() 2026-04-17 21:21:16 +10:00
fdt_strerror.c libfdt: Add ALIGNMENT error string 2021-08-02 12:21:53 +10:00
fdt_sw.c libfdt: fix UBSAN null pointer in fdt_property() 2026-05-20 11:35:03 +10:00
fdt_wip.c libfdt: libfdt_wip: Fix comparison warning 2020-10-02 10:30:07 +10:00
libfdt.h libfdt: Fix bugs with unchecked usage of fdt_num_mem_rsv() 2026-04-17 21:21:16 +10:00
libfdt_env.h libfdt: Remove old MacOS strnlen workaround 2025-09-30 12:03:03 +10:00
libfdt_internal.h libfdt: Improve size savings in FDT_RO_PROBE slightly 2025-12-10 17:46:08 +11:00
Makefile.libfdt libfdt: rename libfdt-X.Y.Z.so to libfdt.so.X.Y.Z 2023-08-06 14:53:29 +10:00
meson.build meson: use override_find_program/override_dependency 2025-06-12 15:55:00 +10:00
sbom.cdx.json libfdt: Move the SBOM authors section 2024-11-20 16:16:57 +11:00
TODO libfdt: Document most remaining functions 2025-08-01 11:34:18 +10:00
version.lds libfdt: Add fdt_setprop_namelen() 2024-12-06 16:42:25 +11:00