[PATCH 4/5] commands: nv: fail if required var arguments are missing

Enrico Jorns ejo at pengutronix.de
Wed Sep 13 05:23:31 PDT 2017


Signed-off-by: Enrico Jorns <ejo at pengutronix.de>
---
 commands/nv.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/commands/nv.c b/commands/nv.c
index d391f9e6b4..bb13ed1db0 100644
--- a/commands/nv.c
+++ b/commands/nv.c
@@ -56,6 +56,11 @@ static int do_nv(int argc, char *argv[])
 	argc -= optind;
 	argv += optind;
 
+	if (argc == 0) {
+		printf("Invalid usage: Missing argument");
+		return COMMAND_ERROR_USAGE;
+	}
+
 	for (i = 0; i < argc; i++) {
 		int ret;
 		value = strchr(argv[0], '=');
-- 
2.11.0




More information about the barebox mailing list