mirror of
https://github.com/smaeul/u-boot.git
synced 2025-11-20 10:53:08 +00:00
cmd: fdt: Handle 64bit pointers in fdt get addr
The command assumed 32bit pointers so far, with 64bit pointer the command would overwrite a piece of stack. Fix it by extending the array size to cater for 64bit pointer, and use snprintf() to avoid writing past the end of the array ever again. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
3300a60277
commit
22cbd654d3
@ -466,9 +466,9 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
||||
return ret;
|
||||
} else if (subcmd[0] == 'a') {
|
||||
/* Get address */
|
||||
char buf[11];
|
||||
char buf[19];
|
||||
|
||||
sprintf(buf, "0x%p", nodep);
|
||||
snprintf(buf, sizeof(buf), "0x%p", nodep);
|
||||
env_set(var, buf);
|
||||
} else if (subcmd[0] == 's') {
|
||||
/* Get size */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user