aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/epan
diff options
context:
space:
mode:
authormoguz <mehmet.oguz.mnz@gmail.com>2018-09-28 09:44:37 -0700
committerAnders Broman <a.broman58@gmail.com>2018-10-03 15:11:48 +0000
commit4f5bfb60357642b742980f3969ee8dbb91ef020c (patch)
tree7b503bdc0fda6220d7f964a4380a307115474246 /plugins/epan
parent4eae3683ccff87a49a29dd48322807cffaf3b1b6 (diff)
PROFINET: ARServerblock is correctly dissected.
ARServerBlock function causes MalformedPacket error. Padding in the function is fixed. Change-Id: I498b1f15abcaab2a0be19096939fae5402747b68 Reviewed-on: https://code.wireshark.org/review/29899 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com> (cherry picked from commit c3b0bcaed51b80faaed1bdfbfae111ef162f9672) Reviewed-on: https://code.wireshark.org/review/29993
Diffstat (limited to 'plugins/epan')
-rw-r--r--plugins/epan/profinet/packet-dcerpc-pn-io.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/epan/profinet/packet-dcerpc-pn-io.c b/plugins/epan/profinet/packet-dcerpc-pn-io.c
index 528703e3fc..e20c84a321 100644
--- a/plugins/epan/profinet/packet-dcerpc-pn-io.c
+++ b/plugins/epan/profinet/packet-dcerpc-pn-io.c
@@ -8174,7 +8174,7 @@ dissect_AlarmCRBlockRes_block(tvbuff_t *tvb, int offset,
/* dissect the ARServerBlock */
static int
dissect_ARServerBlock(tvbuff_t *tvb, int offset,
- packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow)
+ packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength)
{
char *pStationName;
guint16 u16NameLength, u16padding;
@@ -8193,9 +8193,9 @@ dissect_ARServerBlock(tvbuff_t *tvb, int offset,
pStationName[u16NameLength] = '\0';
proto_tree_add_string (tree, hf_pn_io_cminitiator_station_name, tvb, offset, u16NameLength, pStationName);
offset += u16NameLength;
- /* Padding to next 4 byte allignment in this block */
- u16padding = (u16NameLength-2) & 0x3;
- if (u16padding >0)
+ /* Padding to next 4 byte alignment in this block */
+ u16padding = u16BodyLength - (2 + u16NameLength);
+ if (u16padding > 0)
offset = dissect_pn_padding(tvb, offset, pinfo, tree, u16padding);
return offset;
}
@@ -10019,7 +10019,7 @@ dissect_block(tvbuff_t *tvb, int offset,
dissect_ModuleDiffBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
break;
case(0x8106):
- dissect_ARServerBlock(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow);
+ dissect_ARServerBlock(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength);
break;
case(0x8110):
case(0x8111):