diff options
author | Ahmad Fatoum <ahmad@a3f.at> | 2017-12-21 16:23:42 +0100 |
---|---|---|
committer | Martin Kaiser <wireshark@kaiser.cx> | 2017-12-25 10:25:38 +0000 |
commit | 5a3addd8eb3f7d2d8c8ceaf2789881ff9540bf31 (patch) | |
tree | e11136dca9e11296008fb87d9ff8a0e6d99c15cd /epan/dissectors/packet-epl-profile-parser.c | |
parent | 5f0f2d610fe0a53ff15d60821f77b3aec0f75b22 (diff) |
Fix possible signed overflow
Shouldn't have led to problems so far, assuming sane overflow behavior
and sizeof (int) == sizeof (guint32), but better safe than sorry.
Change-Id: I1e154b311b9f0e3113bc9c7b4d8456ede16804ef
Reviewed-on: https://code.wireshark.org/review/24930
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Diffstat (limited to 'epan/dissectors/packet-epl-profile-parser.c')
-rw-r--r-- | epan/dissectors/packet-epl-profile-parser.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/epan/dissectors/packet-epl-profile-parser.c b/epan/dissectors/packet-epl-profile-parser.c index e4699a7254..31a62f26e5 100644 --- a/epan/dissectors/packet-epl-profile-parser.c +++ b/epan/dissectors/packet-epl-profile-parser.c @@ -672,10 +672,18 @@ epl_wmem_iarray_insert(epl_wmem_iarray_t *iarr, guint32 where, range_admin_t *da g_array_append_vals(iarr->arr, data, 1); } +static int u32cmp(guint32 a, guint32 b) +{ + if (a < b) return -1; + if (a > b) return +1; + + return 0; +} + static int epl_wmem_iarray_cmp(const void *a, const void *b) { - return *(const guint32*)a - *(const guint32*)b; + return u32cmp(*(const guint32*)a, *(const guint32*)b); } /** Makes array suitable for searching */ @@ -716,7 +724,7 @@ find_in_range(const void *_a, const void *_b) if (a->low <= b->high && b->low <= a->high) /* overlap */ return 0; - return a->low - b->low; + return u32cmp(a->low, b->low); } static void* |