From: Tobias Klauser Date: Mon, 12 Aug 2013 19:30:01 +0000 (+0200) Subject: dissector: icmpv6: Fix compiler warnings X-Git-Tag: v0.5.8-rc3~12 X-Git-Url: https://repo.or.cz/w/netsniff-ng.git/commitdiff_plain/22c1e59bc41a62b1911ece888acf79c7eb3e7f2f dissector: icmpv6: Fix compiler warnings Fix the following compiler warnings that occur when building with "-W -Wall -Wextra": proto_icmpv6.c: In function ‘dissect_icmpv6_mcast_rec’: proto_icmpv6.c:326:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] proto_icmpv6.c: In function ‘dissect_neighb_disc_ops_15’: proto_icmpv6.c:537:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] proto_icmpv6.c:542:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] proto_icmpv6.c: In function ‘dissect_neighb_disc_ops_16’: proto_icmpv6.c:604:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] proto_icmpv6.c: In function ‘dissect_neighb_disc_ops_17’: proto_icmpv6.c:650:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by: Tobias Klauser --- diff --git a/proto_icmpv6.c b/proto_icmpv6.c index 77c89b12..ada5fdd2 100644 --- a/proto_icmpv6.c +++ b/proto_icmpv6.c @@ -22,7 +22,7 @@ #include "pkt_buff.h" #include "built_in.h" -#define icmpv6_code_range_valid(code, sarr) ((code) < array_size((sarr))) +#define icmpv6_code_range_valid(code, sarr) ((size_t) (code) < array_size((sarr))) struct icmpv6_general_hdr { uint8_t h_type; @@ -539,7 +539,7 @@ static int8_t dissect_neighb_disc_ops_15(struct pkt_buff *pkt, icmpv6_neighb_disc_ops_15_name[ icmp_neighb_disc_15->name_type - 1] : "Unknown", icmp_neighb_disc_15->name_type); - if (pad_len > len) { + if (pad_len > (size_t) len) { tprintf("Pad Len (%zu, invalid)\n%s", pad_len, colorize_start_full(black, red) "Skip Option" colorize_end());