Changeset 80eaf45 in rtems

Timestamp:
07/09/18 04:50:38 (6 years ago)
Author:
David Gibson <david@…>
Branches:
5, master
Children:
2af004e
Parents:
4fd05d3
git-author:
David Gibson <david@…> (07/09/18 04:50:38)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/19/18 05:01:12)
Message:

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@…>

(No files)

Note: See TracChangeset for help on using the changeset viewer.