Skip to content
Snippets Groups Projects
Commit d13ffa66 authored by Kyle Moffett's avatar Kyle Moffett Committed by Gerald Van Baren
Browse files

fdt_support: Fix buffer overflow in fdt_fixup_memory_banks


When fdt_fixup_memory_banks is called with 2-cell address and size
fields in the device-tree (IE: 64-bit address and size), then it will
overflow its on-stack "tmp" buffer.

This fixes the buffer size and adds a comment explaining how many bytes
need to be allocated per record.

Signed-off-by: default avatarKyle Moffett <Kyle.D.Moffett@boeing.com>
Cc: Jerry Van Baren <vanbaren@cideas.com>
Acked-by: default avatarGerald Van Baren <vanbaren@cideas.com>
parent 73e5476e
No related branches found
No related tags found
No related merge requests found
......@@ -394,7 +394,7 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
{
int err, nodeoffset;
int addr_cell_len, size_cell_len, len;
u8 tmp[banks * 8];
u8 tmp[banks * 16]; /* Up to 64-bit address + 64-bit size */
int bank;
err = fdt_check_header(blob);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment