aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-s7comm_szl_ids.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-11-30 21:52:35 -0500
committerMichael Mann <mmann78@netscape.net>2015-12-01 04:15:21 +0000
commit858c3f0079f987833fb22eba2c361d1a88ba4103 (patch)
tree70f29fdebb487e7b8dfa1ff9638bf0c28f4e5b56 /epan/dissectors/packet-s7comm_szl_ids.c
parent212f2f1761e56d9177f4282292d9281e8bb225bb (diff)
[S7COMM] Prevent divide by zero.
Bug: 11823 Change-Id: I4437efb3dc9532e3d29aacd36736d6f7b3ed38a2 Reviewed-on: https://code.wireshark.org/review/12322 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-s7comm_szl_ids.c')
-rw-r--r--epan/dissectors/packet-s7comm_szl_ids.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/epan/dissectors/packet-s7comm_szl_ids.c b/epan/dissectors/packet-s7comm_szl_ids.c
index 34e9376deb..7d914f565a 100644
--- a/epan/dissectors/packet-s7comm_szl_ids.c
+++ b/epan/dissectors/packet-s7comm_szl_ids.c
@@ -4010,11 +4010,13 @@ s7comm_decode_ud_cpu_szl_subfunc(tvbuff_t *tvb,
* it's not possible to decode this and following telegrams without knowing the previous requests.
*/
tbytes = 0;
- if ((list_count * list_len) > (len - 8)) {
- list_count = (len - 8) / list_len;
- /* remind the number of trailing bytes */
- if (list_count > 0) {
- tbytes = (len - 8) % list_count;
+ if (list_len > 0) {
+ if ((list_count * list_len) > (len - 8)) {
+ list_count = (len - 8) / list_len;
+ /* remind the number of trailing bytes */
+ if (list_count > 0) {
+ tbytes = (len - 8) % list_count;
+ }
}
}
offset += 2;