diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2018-07-09 14:50:38 +1000 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2018-07-09 15:03:14 +1000 |
commit | 1087504bb3e8b00988e7bb99784eb02d4d9d9fd1 (patch) | |
tree | 14f6063b423e5ada775fa67176390f2a8d113e23 /tests | |
parent | c72fa777e61383850436f9f9cac3b0ddae41317b (diff) | |
download | dtc-1087504bb3e8b00988e7bb99784eb02d4d9d9fd1.zip dtc-1087504bb3e8b00988e7bb99784eb02d4d9d9fd1.tar.gz dtc-1087504bb3e8b00988e7bb99784eb02d4d9d9fd1.tar.bz2 |
libfdt: Add necessary header padding in fdt_create()
At present fdt_create() will succeed if there is exactly enough space to
put in the fdt header. However, it sets the off_mem_rsvmap field, a few
bytes past that in order to align the memory reservation block.
Having block pointers pointing past the end of the fdt is pretty ugly, even
if it is just a transient state. Worse, if fdt_resize() is called at
exactly the wrong time, it can end up accessing data past the blob's
allocated space because of this.
So, correct fdt_create() to ensure that there is sufficient space for the
alignment padding as well as the plain header. For paranoia, also add a
check in fdt_resize() to make sure we don't copy data from outside the
blob's bounds.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions