[coreboot-gerrit] New patch to review for coreboot: cbfstool: Check for excessive arguments

Nico Huber (nico.h@gmx.de) gerrit at coreboot.org
Mon Aug 1 23:23:00 CEST 2016


Nico Huber (nico.h at gmx.de) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16019

-gerrit

commit f4c9a679648963f433d0334e56c764841a5c4d3e
Author: Nico Huber <nico.h at gmx.de>
Date:   Mon Aug 1 23:18:29 2016 +0200

    cbfstool: Check for excessive arguments
    
    Change-Id: I66de6a33b43c284198c0a0a97c5c6a10f9b96e02
    Signed-off-by: Nico Huber <nico.h at gmx.de>
---
 util/cbfstool/cbfstool.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 7b30ce9..79cda7f 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -1296,8 +1296,14 @@ int main(int argc, char **argv)
 
 			c = getopt_long(argc, argv, commands[i].optstring,
 						long_options, &option_index);
-			if (c == -1)
+			if (c == -1) {
+				if (optind < argc) {
+					ERROR("%s: excessive argument -- '%s'"
+						"\n", argv[0], argv[optind]);
+					return 1;
+				}
 				break;
+			}
 
 			/* filter out illegal long options */
 			if (strchr(commands[i].optstring, c) == NULL) {



More information about the coreboot-gerrit mailing list