aboutsummaryrefslogtreecommitdiff
path: root/pcap-bpf.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcap-bpf.c')
-rw-r--r--pcap-bpf.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/pcap-bpf.c b/pcap-bpf.c
index 38844887..7286d884 100644
--- a/pcap-bpf.c
+++ b/pcap-bpf.c
@@ -1672,6 +1672,17 @@ pcap_activate_bpf(pcap_t *p)
goto bad;
}
+ /*
+ * 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 defined(LIFNAMSIZ) && defined(ZONENAME_MAX) && defined(lifr_zoneid)
/*
* Retrieve the zoneid of the zone we are currently executing in.