LNET: fix malformed packet error on RDMA Read Request

Check the number of remaining bytes before comparing the
next four bytes to the LNet magic number to find out
whether or not this is an LNet layer.
In the case for an RDMA Read Request which does not have
any payload data, the LNet dissector now gracefully will
not process this packet as an LNet layer instead of
labeling it as a malformed packet.

Bug: 16269
Change-Id: I5d6abea8b79619849e8fbc1bc6b585995736b56e
Reviewed-on: https://code.wireshark.org/review/35392
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
This commit is contained in:
Jorge Mora 2019-12-10 10:32:23 -07:00 committed by Jaap Keuter
parent e8aa574aff
commit 34cbff30e9
1 changed files with 1 additions and 1 deletions

View File

@ -903,7 +903,7 @@ dissect_lnet_ib_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
{
/* We can tell if this is an LNet payload by looking at the first
* 32-bit word for our magic number. */
if (tvb_get_letohl(tvb, 0) != LNET_PROTO_IB_MAGIC)
if (tvb_captured_length(tvb) < 4 || tvb_get_letohl(tvb, 0) != LNET_PROTO_IB_MAGIC)
/* Not an LNet payload. */
return FALSE;