summaryrefslogtreecommitdiffstats
path: root/src/elfcmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/elfcmp.c')
-rw-r--r--src/elfcmp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/elfcmp.c b/src/elfcmp.c
index 2d85f0b2..d1008b3c 100644
--- a/src/elfcmp.c
+++ b/src/elfcmp.c
@@ -1,5 +1,5 @@
/* Compare relevant content of two ELF files.
- Copyright (C) 2005-2012 Red Hat, Inc.
+ Copyright (C) 2005-2012, 2014 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <[email protected]>, 2005.
@@ -355,7 +355,8 @@ main (int argc, char *argv[])
sym1->st_name);
const char *name2 = elf_strptr (elf2, shdr2->sh_link,
sym2->st_name);
- if (unlikely (strcmp (name1, name2) != 0
+ if (unlikely (name1 == NULL || name2 == NULL
+ || strcmp (name1, name2) != 0
|| sym1->st_value != sym2->st_value
|| (sym1->st_size != sym2->st_size
&& sym1->st_shndx != SHN_UNDEF)
@@ -810,8 +811,7 @@ compare_Elf32_Word (const void *p1, const void *p2)
{
const Elf32_Word *w1 = p1;
const Elf32_Word *w2 = p2;
- assert (sizeof (int) >= sizeof (*w1));
- return (int) *w1 - (int) *w2;
+ return *w1 < *w2 ? -1 : *w1 > *w2 ? 1 : 0;
}
static int