aboutsummaryrefslogtreecommitdiff
path: root/pcap-nit.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcap-nit.c')
-rw-r--r--pcap-nit.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/pcap-nit.c b/pcap-nit.c
index b18f8155..bb5fef77 100644
--- a/pcap-nit.c
+++ b/pcap-nit.c
@@ -271,6 +271,17 @@ pcap_activate_nit(pcap_t *p)
return (PCAP_ERROR_RFMON_NOTSUP);
}
+ /*
+ * 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 (p->snapshot < 96)
/*
* NIT requires a snapshot length of at least 96.