aboutsummaryrefslogtreecommitdiff
path: root/pcap-dag.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcap-dag.c')
-rw-r--r--pcap-dag.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/pcap-dag.c b/pcap-dag.c
index 80ed01a2..3f68cd6c 100644
--- a/pcap-dag.c
+++ b/pcap-dag.c
@@ -793,6 +793,17 @@ static int dag_activate(pcap_t* handle)
goto faildetach;
}
+ /*
+ * 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 (p->snapshot <= 0 || p->snapshot > MAXIMUM_SNAPLEN)
+ p->snapshot = MAXIMUM_SNAPLEN;
+
if (handle->opt.immediate) {
/* Call callback immediately.
* XXX - is this the right way to handle this?