don't compare data on NOBITS sections

NOBITS section may have a non-zero size, however, the have no data and
the data descriptor will have d_buf set to NULL.

This commit fixes as segfault that occurs from trying to compare the
data of such sections.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
This commit is contained in:
Seth Jennings 2014-02-13 11:02:53 -06:00
parent d927215dda
commit d32ca30052

View File

@ -441,7 +441,8 @@ void kpatch_compare_correlated_section(struct section *sec)
if (sec1->sh.sh_size != sec2->sh.sh_size ||
sec1->data->d_size != sec2->data->d_size ||
memcmp(sec1->data->d_buf, sec2->data->d_buf, sec1->data->d_size))
(sec1->sh.sh_type != SHT_NOBITS &&
memcmp(sec1->data->d_buf, sec2->data->d_buf, sec1->data->d_size)))
sec1->status = CHANGED;
else
sec1->status = SAME;