aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-01-30 23:39:54 -0800
committerGuy Harris <guy@alum.mit.edu>2019-01-31 07:40:32 +0000
commit498b64c95c13980505e495bad33d911c26c52b8a (patch)
treecc16475b5d0c885111c05f116eccb0d66e269599 /wiretap
parent2a675c0d5b413fa8c1999d0517b00599ea0920dd (diff)
Check whether you've hit the end of the packet data before going further.
If we found no bytes with the low-order bit set in the packet data, there's no point in checking the non-existent "next" byte to see if it's a HDLC-style UI control byte (0x03). Bug: 15463 Change-Id: Ibfd186e5b81d8ce229362e23f00b31a27900831a Reviewed-on: https://code.wireshark.org/review/31824 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/ngsniffer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
index 95262a6412..3bc20a774b 100644
--- a/wiretap/ngsniffer.c
+++ b/wiretap/ngsniffer.c
@@ -1783,13 +1783,14 @@ infer_pkt_encap(const guint8 *pd, int len)
*/
for (i = 0; i < len && (pd[i] & 0x01) == 0; i++)
;
- i++; /* advance to the byte after the last DLCI byte */
if (i == len) {
/*
- * No control byte.
+ * No control byte - all the bytes have the
+ * low-order bit clear.
*/
return WTAP_ENCAP_LAPB;
}
+ i++; /* advance to the byte after the last DLCI byte */
if (pd[i] == 0x03)
return WTAP_ENCAP_FRELAY_WITH_PHDR;
}