summaryrefslogtreecommitdiff
path: root/util/romcc
diff options
context:
space:
mode:
authorJacob Garber <jgarber1@ualberta.ca>2019-05-21 18:55:34 -0600
committerPatrick Georgi <pgeorgi@google.com>2019-05-23 09:01:57 +0000
commit4b688ab3fe6a8db4985a6e6cdad5def661f4066a (patch)
tree86f8fba6c9778ecb47c02b3bc65a8d2249cbbe7f /util/romcc
parentb4222a65adcbacdb056fea88abd300c897eabfc2 (diff)
downloadcoreboot-4b688ab3fe6a8db4985a6e6cdad5def661f4066a.tar.xz
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>
Diffstat (limited to 'util/romcc')
-rw-r--r--util/romcc/romcc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c
index 571a29f94b..285b0237f4 100644
--- a/util/romcc/romcc.c
+++ b/util/romcc/romcc.c
@@ -1989,7 +1989,7 @@ static struct occurrence *new_occurrence(struct compile_state *state)
(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;