diff options
Diffstat (limited to 'pcap-usb-linux.c')
-rw-r--r-- | pcap-usb-linux.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c index bf9a4e5a..353f0b57 100644 --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c @@ -497,6 +497,17 @@ usb_activate(pcap_t* handle) struct pcap_usb_linux *handlep = handle->priv; char full_path[USB_LINE_LEN]; + /* + * 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 = handle->snapshot; handle->offset = 0; |