summaryrefslogtreecommitdiffstats
path: root/src/elfcmp.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2014-12-16 11:04:55 +0100
committerMark Wielaard <[email protected]>2014-12-17 16:30:33 +0100
commit274cbda6f5d5b7c57d488edaeb55876ba8705db3 (patch)
tree4a9ec2fd596935c0335ddf6e9f8c3fe9097bcde7 /src/elfcmp.c
parentc8a0273dd506b8d2dfcf8412d34459d3bb8a18db (diff)
elfcmp: Make sure Elf32_Word difference doesn't wrap around in int compare.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src/elfcmp.c')
-rw-r--r--src/elfcmp.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/elfcmp.c b/src/elfcmp.c
index c420019f..d1008b3c 100644
--- a/src/elfcmp.c
+++ b/src/elfcmp.c
@@ -811,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