diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-08-07 20:38:11 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-08-08 03:39:08 +0000 |
commit | 20c0fffc922e09cbb0dbd4317080d3f9ed6a9cae (patch) | |
tree | ec38eb9750ca7d77dbc545bdb738487547022402 /epan/dissectors/packet-iwarp-mpa.c | |
parent | c10396dbbf782a576bc1f9a931cf86090cec3878 (diff) |
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 <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-iwarp-mpa.c')
-rw-r--r-- | epan/dissectors/packet-iwarp-mpa.c | 4 |
1 files changed, 2 insertions, 2 deletions
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 <epan/conversation.h> #include <epan/dissectors/packet-tcp.h> #include <epan/expert.h> +#include <epan/crc32-tvb.h> #include <wsutil/crc32.h> 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 */ |