[PATCH v2 06/32] cmd: fdt: Check argc before accessing argv in fdt memory

Simon Glass sjg at chromium.org
Wed Mar 8 23:17:04 CET 2023


On case 'fdt memory' is invoked without parameters, argv[2]/argv[3]
is not valid and this command would SEGFAULT in sandbox environment.
Add missing argc test to avoid the crash and rather print usage help
message.

Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
Reviewed-by: Simon Glass <sjg at chromium.org>
---
Cc: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Tom Rini <trini at konsulko.com>
---
V2: Add RB from Simon
---
 cmd/fdt.c | 4 ++++
 1 file changed, 4 insertions(+)

Applied to u-boot-dm/next, thanks!


More information about the U-Boot mailing list