[coreboot-gerrit] New patch to review for coreboot: 2b2169f sconfig: improve argument parsing

Patrick Georgi (patrick@georgi-clan.de) gerrit at coreboot.org
Sun Aug 3 15:39:01 CEST 2014


Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6483

-gerrit

commit 2b2169fdb7784ea92020a486d32003afdef463d3
Author: Patrick Georgi <patrick at georgi-clan.de>
Date:   Sun Aug 3 15:27:35 2014 +0200

    sconfig: improve argument parsing
    
    Running sconfig with four arguments where the third
    does not match /-./ made sconfig use uninitialized
    memory to build the output filename.
    
    Change-Id: If4a147ff23771ca9b6a913605af60249be1ca3d0
    Found-By: Coverity Scan
    Signed-off-by: Patrick Georgi <patrick at georgi-clan.de>
---
 util/sconfig/main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index f6ec0e2..20471de 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -570,7 +570,10 @@ int main(int argc, char** argv) {
 		scan_mode = STATIC_MODE;
 		outputc=malloc(strlen(outputdir)+20);
 		sprintf(outputc, "%s/static.c", outputdir);
-	} else if ((argc == 5) && (argv[3][0] == '-') && (argv[3][2] == 0)) {
+	} else if (argc == 5) {
+		if ((argv[3][0] != '-') || (argv[3][2] == 0)) {
+			usage();
+		}
 
 		switch (argv[3][1]) {
 		case 's':



More information about the coreboot-gerrit mailing list