From 20c0fffc922e09cbb0dbd4317080d3f9ed6a9cae Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 7 Aug 2014 20:38:11 -0700 Subject: Wrap some tvb_get_ptr calls in crc32c_tvb_offset_calculate(). This eliminates some tvb_get_ptr calls from dissectors, as part of trying to minimize if not eliminate its use in dissectors (it's a bit of what's called an "attractive nuisance", in that users who don't understand what it does - and doesn't! - do may use it in ways that are unsafe, e.g. thinking you can use it to get a null-terminated string from a packet). It also eliminates the possibility of passing one length to tvb_get_ptr() and another to crc32c_calculate(). Change-Id: I8a07168d0bc088b45d607e00c5bb1d98421ebc73 Reviewed-on: https://code.wireshark.org/review/3488 Reviewed-by: Guy Harris --- epan/dissectors/packet-iwarp-mpa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'epan/dissectors/packet-iwarp-mpa.c') diff --git a/epan/dissectors/packet-iwarp-mpa.c b/epan/dissectors/packet-iwarp-mpa.c index f7364c84c7..a88bfdb131 100644 --- a/epan/dissectors/packet-iwarp-mpa.c +++ b/epan/dissectors/packet-iwarp-mpa.c @@ -32,6 +32,7 @@ #include #include #include +#include #include void proto_register_mpa(void); @@ -581,8 +582,7 @@ dissect_fpdu_crc(tvbuff_t *tvb, proto_tree *tree, mpa_state_t *state, if (state->crc) { - crc = ~crc32c_calculate(tvb_get_ptr(tvb, 0, length), length, - CRC32C_PRELOAD); + crc = ~crc32c_tvb_offset_calculate(tvb, 0, length, CRC32C_PRELOAD); sent_crc = tvb_get_ntohl(tvb, offset); /* crc start offset */ -- cgit v1.2.3