diff options
Diffstat (limited to 'pcap-netfilter-linux.c')
-rw-r--r-- | pcap-netfilter-linux.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pcap-netfilter-linux.c b/pcap-netfilter-linux.c index 49438cda..b8c4f0d2 100644 --- a/pcap-netfilter-linux.c +++ b/pcap-netfilter-linux.c @@ -479,6 +479,17 @@ netfilter_activate(pcap_t* handle) group_count = 1; } + /* + * 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 = 128 + handle->snapshot; handle->offset = 0; |