mirror of
https://github.com/dgibson/dtc.git
synced 2025-12-08 12:45:29 -05:00
The libfdt functions are supposed to behave tolerably well when practical, even if given a corrupted device tree as input. A silly mistake in fdt_get_property() means we're bounds checking against the size of a pointer instead of the size of a property header, meaning we can get bogus behaviour in a corrupted device tree where the structure block ends in what's supposed to be the middle of a property. This patch corrects the problem (fdt_get_property() will now return BADSTRUCTURE in this case), and also adds a testcase to catch the bug.
9 lines
233 B
C
9 lines
233 B
C
#define TEST_VALUE_1 0xdeadbeef
|
|
#define TEST_VALUE_2 0xabcd1234
|
|
|
|
#define TEST_STRING_1 "hello world"
|
|
|
|
#ifndef __ASSEMBLY__
|
|
extern struct fdt_header _test_tree1;
|
|
extern struct fdt_header _truncated_property;
|
|
#endif /* ! __ASSEMBLY */
|