create-diff-object: null checks in rela_equal()

Make sure rela_toc(1|2) are not null before dereferencing them in
rela_equal().

Found by covscan, see issue #984 for full log.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
This commit is contained in:
Artem Savkov 2019-07-31 13:33:20 +02:00
parent d60579e8d4
commit f367438b19

View File

@ -373,6 +373,9 @@ static int rela_equal(struct rela *rela1, struct rela *rela2)
if (!rela_toc1 && !rela_toc2)
return toc_data1 == toc_data2;
if (!rela_toc1 || !rela_toc2)
return 0;
if (rela_toc1->string)
return rela_toc2->string && !strcmp(rela_toc1->string, rela_toc2->string);