Also check whether we have nothing but DLCI bytes.

The two failure modes are 1) no byte has the low-order bit set, so we
didn't even find the end of the DLCI or 2) the byte at the end of the
packet has the low-order bit set, so that it's all DLCI with no control
byte after it.

Expand a comment.

Bug: 15463
Change-Id: Ib76686391213dd56c06d665aa87a188621fe6816
Reviewed-on: https://code.wireshark.org/review/31828
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2019-01-31 00:59:01 -08:00
parent 8cfad3fd56
commit b5817dbda7
1 changed files with 8 additions and 4 deletions

View File

@ -1766,7 +1766,7 @@ infer_pkt_encap(const guint8 *pd, int len)
* although there might be other frame types as well.
* Scan forward until we see the last DLCI byte, with
* the low-order bit being 1, and then check the next
* byte to see if it's a control byte.
* byte, if it exists, to see if it's a control byte.
*
* XXX - in version 4 and 5 captures, wouldn't this just
* have a capture subtype of NET_FRAME_RELAY? Or is this
@ -1783,10 +1783,14 @@ infer_pkt_encap(const guint8 *pd, int len)
*/
for (i = 0; i < len && (pd[i] & 0x01) == 0; i++)
;
if (i == len) {
if (i >= len - 1) {
/*
* No control byte - all the bytes have the
* low-order bit clear.
* Either all the bytes have the low-order bit
* clear, so we didn't even find the last DLCI
* byte, or the very last byte had the low-order
* bit set, so, if that's a DLCI, it fills the
* buffer, so there is no control byte after
* the last DLCI byte.
*/
return WTAP_ENCAP_LAPB;
}