mirror of
https://github.com/dgibson/dtc.git
synced 2026-07-10 13:29:48 -04:00
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> |
||
|---|---|---|
| .. | ||
| .gitignore | ||
| fdt.c | ||
| fdt.h | ||
| fdt_addresses.c | ||
| fdt_check.c | ||
| fdt_empty_tree.c | ||
| fdt_overlay.c | ||
| fdt_ro.c | ||
| fdt_rw.c | ||
| fdt_strerror.c | ||
| fdt_sw.c | ||
| fdt_wip.c | ||
| libfdt.h | ||
| libfdt_env.h | ||
| libfdt_internal.h | ||
| Makefile.libfdt | ||
| meson.build | ||
| sbom.cdx.json | ||
| TODO | ||
| version.lds | ||