aboutsummaryrefslogtreecommitdiff
path: root/pcap-bt-linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcap-bt-linux.c')
-rw-r--r--pcap-bt-linux.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/pcap-bt-linux.c b/pcap-bt-linux.c
index 8a258ebf..ac5e529b 100644
--- a/pcap-bt-linux.c
+++ b/pcap-bt-linux.c
@@ -197,6 +197,17 @@ bt_activate(pcap_t* handle)
return PCAP_ERROR;
}
+ /*
+ * Turn a negative snapshot value (invalid), a snapshot value of
+ * 0 (unspecified), or a value bigger than the normal maximum
+ * value, into the maximum allowed value.
+ *
+ * If some application really *needs* a bigger snapshot
+ * length, we should just increase MAXIMUM_SNAPLEN.
+ */
+ if (handle->snapshot <= 0 || handle->snapshot > MAXIMUM_SNAPLEN)
+ handle->snapshot = MAXIMUM_SNAPLEN;
+
/* Initialize some components of the pcap structure. */
handle->bufsize = BT_CTRL_SIZE+sizeof(pcap_bluetooth_h4_header)+handle->snapshot;
handle->linktype = DLT_BLUETOOTH_HCI_H4_WITH_PHDR;