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@georgi-clan.de> Reviewed-on: http://review.coreboot.org/6483 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
parent
80fd01d2cc
commit
6fa6843a8d
|
@ -570,7 +570,10 @@ int main(int argc, char** argv) {
|
||||||
scan_mode = STATIC_MODE;
|
scan_mode = STATIC_MODE;
|
||||||
outputc=malloc(strlen(outputdir)+20);
|
outputc=malloc(strlen(outputdir)+20);
|
||||||
sprintf(outputc, "%s/static.c", outputdir);
|
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]) {
|
switch (argv[3][1]) {
|
||||||
case 's':
|
case 's':
|
||||||
|
|
Loading…
Reference in New Issue