aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-hdfsdata.c
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2013-03-07 02:04:41 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2013-03-07 02:04:41 +0000
commitcfcd6deca18b127a34eb7096e020bd72bd7ea794 (patch)
treed85835704e4b36c1fb2f853c668b22a2076fe258 /epan/dissectors/packet-hdfsdata.c
parent7e8c551af09c42b1086ab974155bb8c4f2e39590 (diff)
Avoid a potential divide-by-zero condition.
#BACKPORT(1.8) svn path=/trunk/; revision=48159
Diffstat (limited to 'epan/dissectors/packet-hdfsdata.c')
-rw-r--r--epan/dissectors/packet-hdfsdata.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/epan/dissectors/packet-hdfsdata.c b/epan/dissectors/packet-hdfsdata.c
index 21ff553f03..bbd670653c 100644
--- a/epan/dissectors/packet-hdfsdata.c
+++ b/epan/dissectors/packet-hdfsdata.c
@@ -211,6 +211,7 @@ static void
dissect_read_response(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int offset)
{
int len = 0;
+ guint32 chunksize;
/* 4 bytes = data length */
proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_datalength, tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -233,9 +234,12 @@ dissect_read_response(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int offset)
offset += 4;
/* if there is a crc checksum it is 8* the length of the data * checksum size / chunksize */
+ chunksize = tvb_get_ntohl(tvb, CHUNKSIZE_START);
+ if (chunksize == 0) /* let's not divide by zero */
+ return;
if (tvb_get_guint8(tvb, 2) == CRC) {
len = (int)(CRC_SIZE * tvb_get_ntohl(tvb, offset - 4) *
- tvb_get_ntohl(tvb, offset - 8) / tvb_get_ntohl(tvb, CHUNKSIZE_START));
+ tvb_get_ntohl(tvb, offset - 8) / chunksize);
}
/* the rest of bytes (usually 4) = crc32 code */