]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - client/proxmark3.c
Fix memory bounds error
[proxmark3-svn] / client / proxmark3.c
index d0e68b6121a32086d8109badf8f768a28c154eee..99ba9fbad77ec9dbcea40bc0b36074ea7914b0e5 100644 (file)
@@ -73,12 +73,11 @@ static void *uart_receiver(void *targ) {
 
        while (arg->run) {
                rxlen = 0;
 
        while (arg->run) {
                rxlen = 0;
-               if (uart_receive(sp, prx, sizeof(UsbCommand) - (prx-rx), &rxlen)) {
+               if (uart_receive(sp, prx, sizeof(UsbCommand) - (prx-rx), &rxlen) && rxlen) {
                        prx += rxlen;
                        if (prx-rx < sizeof(UsbCommand)) {
                                continue;
                        }
                        prx += rxlen;
                        if (prx-rx < sizeof(UsbCommand)) {
                                continue;
                        }
-                       
                        UsbCommandReceived((UsbCommand*)rx);
                }
                prx = rx;
                        UsbCommandReceived((UsbCommand*)rx);
                }
                prx = rx;
@@ -356,11 +355,13 @@ int main(int argc, char* argv[]) {
                sp = uart_open(argv[1]);
        } else {
                printf("Waiting for Proxmark to appear on %s ", argv[1]);
                sp = uart_open(argv[1]);
        } else {
                printf("Waiting for Proxmark to appear on %s ", argv[1]);
+               fflush(stdout);
                int openCount = 0;
                do {
                        sp = uart_open(argv[1]);
                        msleep(1000);
                        printf(".");
                int openCount = 0;
                do {
                        sp = uart_open(argv[1]);
                        msleep(1000);
                        printf(".");
+                       fflush(stdout);
                } while(++openCount < 20 && (sp == INVALID_SERIAL_PORT || sp == CLAIMED_SERIAL_PORT));
                printf("\n");
        }
                } while(++openCount < 20 && (sp == INVALID_SERIAL_PORT || sp == CLAIMED_SERIAL_PORT));
                printf("\n");
        }
Impressum, Datenschutz