Commit d0b3ab0a authored by David Gibson's avatar David Gibson
Browse files

libfdt: Fix undefined behaviour in fdt_offset_ptr()



Using pointer arithmetic to generate a pointer outside a known object is,
technically, undefined behaviour in C.  Unfortunately, we were using that
in fdt_offset_ptr() to detect overflows.

To fix this we need to do our bounds / overflow checking on the offsets
before constructing pointers from them.

Reported-by: default avatarDavid Binderman <dcb314@hotmail.com>
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent d4c7c25c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment