Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32922
Change subject: util/romcc: Add null check for filename ......................................................................
util/romcc: Add null check for filename
It is possible that 'filename' is still null in this if statement, so we add an extra check to prevent a null dereference in strcmp.
Change-Id: Iaba95b63a4d552051e0c56445522de7274dfd0b3 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 1395330 --- M util/romcc/romcc.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/22/32922/1
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c index b9ec835..1011ed4 100644 --- a/util/romcc/romcc.c +++ b/util/romcc/romcc.c @@ -1989,7 +1989,7 @@ (last->line == line) && (last->function == function) && ((last->filename == filename) || - (strcmp(last->filename, filename) == 0))) + (filename != NULL && strcmp(last->filename, filename) == 0))) { get_occurrence(last); return last;
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32922 )
Change subject: util/romcc: Add null check for filename ......................................................................
Patch Set 1: Code-Review+2
Patrick Georgi has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/32922 )
Change subject: util/romcc: Add null check for filename ......................................................................
util/romcc: Add null check for filename
It is possible that 'filename' is still null in this if statement, so we add an extra check to prevent a null dereference in strcmp.
Change-Id: Iaba95b63a4d552051e0c56445522de7274dfd0b3 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 1395330 Reviewed-on: https://review.coreboot.org/c/coreboot/+/32922 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Patrick Georgi pgeorgi@google.com --- M util/romcc/romcc.c 1 file changed, 1 insertion(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c index 571a29f..285b023 100644 --- a/util/romcc/romcc.c +++ b/util/romcc/romcc.c @@ -1989,7 +1989,7 @@ (last->line == line) && (last->function == function) && ((last->filename == filename) || - (strcmp(last->filename, filename) == 0))) + (filename != NULL && strcmp(last->filename, filename) == 0))) { get_occurrence(last); return last;