Patrick Georgi merged this change.
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(-)
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;
To view, visit change 32922. To unsubscribe, or for help writing mail filters, visit settings.