summaryrefslogtreecommitdiffstats
path: root/src/elfcmp.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2015-05-30 23:55:50 +0200
committerMark Wielaard <[email protected]>2015-06-05 14:44:59 +0200
commit0d528f9ceff2b96c521cefd75fc62d7151e3e6b1 (patch)
treeb25f24d56f890564cc50933b1635e7705c7a253c /src/elfcmp.c
parentfc9b79400a7bf1aa399cadf5e0351d757a4e44a6 (diff)
elfcmp: Don't call memcmp with possible NULL d_buf.
When d_size is zero d_buf might be NULL. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src/elfcmp.c')
-rw-r--r--src/elfcmp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/elfcmp.c b/src/elfcmp.c
index f8a4572d..0250fbe3 100644
--- a/src/elfcmp.c
+++ b/src/elfcmp.c
@@ -1,5 +1,5 @@
/* Compare relevant content of two ELF files.
- Copyright (C) 2005-2012, 2014 Red Hat, Inc.
+ Copyright (C) 2005-2012, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <[email protected]>, 2005.
@@ -511,6 +511,7 @@ cannot read note section [%zu] '%s' in '%s': %s"),
if (unlikely (data1->d_size != data2->d_size
|| (shdr1->sh_type != SHT_NOBITS
+ && data1->d_size != 0
&& memcmp (data1->d_buf, data2->d_buf,
data1->d_size) != 0)))
{