]> git.ipfire.org Git - thirdparty/u-boot.git/commit
cmd: nvedit: Validate argument count before use
authorMarek Vasut <marek.vasut+renesas@mailbox.org>
Wed, 17 Dec 2025 19:57:38 +0000 (20:57 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 18 Dec 2025 16:26:22 +0000 (10:26 -0600)
commit2333d446b7b133ddfb9dea2d53996d560796ecd9
treee594b88da8784301cf02c4823d396af63f00fdf4
parentd865f2f0162b1121f271bd3e6c1e3f171036aec9
cmd: nvedit: Validate argument count before use

Avoid NULL pointer dereference in case 'env select' is invoked
without parameters, check the arg count and make sure it is at
least 2, otherwise print usage.

The crash is easy to trigger e.g. in sandbox:
$ ./u-boot -Tc "env select"

Fixes: a97d22ebba23 ("cmd: env: add env select command")
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Tested-by: Vincent Stehlé <vincent.stehle@arm.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
cmd/nvedit.c