]> The Tcpdump Group git mirrors - libpcap/commitdiff
Use the read byte count when scanning through the results of the read.
authorGuy Harris <[email protected]>
Thu, 13 Sep 2018 04:36:42 +0000 (21:36 -0700)
committerGuy Harris <[email protected]>
Thu, 13 Sep 2018 04:36:42 +0000 (21:36 -0700)
pcap-usb-linux.c

index 2ebd70372b3f96d858fe23b07b3b7df6c2fab8b2..49d67272d7154e0e47d1e80f14f907e381b116b7 100644 (file)
@@ -934,8 +934,8 @@ static int
 usb_stats_linux(pcap_t *handle, struct pcap_stat *stats)
 {
        struct pcap_usb_linux *handlep = handle->priv;
-       int dummy, ret, consumed, cnt;
-       ssize_t read_ret;
+       int dummy, ret, cnt;
+       ssize_t read_ret, consumed;
        char string[USB_LINE_LEN];
        char token[USB_LINE_LEN];
        char * ptr = string;
@@ -977,7 +977,7 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats)
        string[read_ret] = 0;
 
        /* extract info on dropped urbs */
-       for (consumed=0; consumed < ret; ) {
+       for (consumed=0; consumed < read_ret; ) {
                /* from the sscanf man page:
                 * The C standard says: "Execution of a %n directive does
                 * not increment the assignment count returned at the completion