diff options
| author | Mark Wielaard <[email protected]> | 2014-12-16 11:04:55 +0100 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2014-12-17 16:30:33 +0100 |
| commit | 274cbda6f5d5b7c57d488edaeb55876ba8705db3 (patch) | |
| tree | 4a9ec2fd596935c0335ddf6e9f8c3fe9097bcde7 /src/elfcmp.c | |
| parent | c8a0273dd506b8d2dfcf8412d34459d3bb8a18db (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.c | 3 |
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 |
