From: Mark Wielaard Date: Sat, 30 May 2015 21:55:50 +0000 (+0200) Subject: elfcmp: Don't call memcmp with possible NULL d_buf. X-Git-Tag: elfutils-0.162~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0d528f9ceff2b96c521cefd75fc62d7151e3e6b1;p=thirdparty%2Felfutils.git 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 --- diff --git a/src/ChangeLog b/src/ChangeLog index 3161aa84c..59d87c8d4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2015-05-30 Mark Wielaard + + * elfcmp.c (main): Only call memcmp when d_size != 0. + 2015-05-23 Mark Wielaard * Makefile.am: Define ldgeneric, readelf, nm, size, strip, elflint, diff --git a/src/elfcmp.c b/src/elfcmp.c index f8a4572d2..0250fbe39 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 , 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))) {