diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-01-31 00:59:01 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-01-31 08:59:41 +0000 |
commit | b5817dbda7de860e8e89cca5d1217d948c065259 (patch) | |
tree | 6689fa9230aa5f3a596ae038d6b2c75675d371b2 /wiretap | |
parent | 8cfad3fd56c235ee2defaf5b4c0d5eefb14bc779 (diff) |
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>
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/ngsniffer.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c index 3bc20a774b..a4b11f7dd4 100644 --- a/wiretap/ngsniffer.c +++ b/wiretap/ngsniffer.c @@ -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; } |