]> The Tcpdump Group git mirrors - libpcap/commitdiff
As is done in the loop in pcap-bpf.c, check for non-positive values of
authorguy <guy>
Sat, 2 Feb 2008 20:58:18 +0000 (20:58 +0000)
committerguy <guy>
Sat, 2 Feb 2008 20:58:18 +0000 (20:58 +0000)
"cnt", not for non-negative values, so a "cnt" of 0 is treated the same
as a "cnt" of -1.

pcap-dlpi.c
pcap-nit.c
pcap-snit.c

index d492d0b16ad94f23b9988b958a8da339f934ad49..ebc20df53761bab712e003fb567baf4310d5310a 100644 (file)
@@ -70,7 +70,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.118 2008-01-30 09:41:52 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.119 2008-02-02 20:58:18 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -357,7 +357,7 @@ pcap_read_dlpi(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
                        if (pkthdr.caplen > p->snapshot)
                                pkthdr.caplen = p->snapshot;
                        (*callback)(user, &pkthdr, pk);
-                       if (++n >= cnt && cnt >= 0) {
+                       if (++n >= cnt && cnt > 0) {
                                p->cc = ep - bp;
                                p->bp = bp;
                                return (n);
index 1e16ab44e7a05190c75356b40dc2e3d659abcd44..4cc122ed222c088fb0c72aa68b357516b49f2df7 100644 (file)
@@ -20,7 +20,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-nit.c,v 1.59 2007-12-05 23:37:26 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/pcap-nit.c,v 1.60 2008-02-02 20:58:18 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -180,7 +180,7 @@ pcap_read_nit(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
                        h.len = nh->nh_wirelen;
                        h.caplen = caplen;
                        (*callback)(user, &h, cp);
-                       if (++n >= cnt && cnt >= 0) {
+                       if (++n >= cnt && cnt > 0) {
                                p->cc = ep - bp;
                                p->bp = bp;
                                return (n);
index bb9e02e87eb78b305f743067796868f9f547bf3e..a14a2c30093d6c36782233996ea294474c725fce 100644 (file)
@@ -25,7 +25,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-snit.c,v 1.74 2007-12-05 23:37:26 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/pcap-snit.c,v 1.75 2008-02-02 20:58:18 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -192,7 +192,7 @@ pcap_read_snit(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
                        h.len = nlp->nh_pktlen;
                        h.caplen = caplen;
                        (*callback)(user, &h, cp);
-                       if (++n >= cnt && cnt >= 0) {
+                       if (++n >= cnt && cnt > 0) {
                                p->cc = ep - bp;
                                p->bp = bp;
                                return (n);