]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
fix a stack overflow in the flasher routine (my bad)
authorbushing <bushing@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Wed, 27 Jan 2010 09:25:37 +0000 (09:25 +0000)
committerbushing <bushing@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Wed, 27 Jan 2010 09:25:37 +0000 (09:25 +0000)
client/flash.c

index b01bb154a2545765feaa0e93a9d04459753fbd55..61d5cf75e2f43c78f8ee062b31f9bb147d803d21 100644 (file)
@@ -52,9 +52,11 @@ void WriteBlock(unsigned int block_start, unsigned int len, unsigned char *buf)
        if (block_start & 0xFF) {
                printf("moving stuff forward by %d bytes\n", block_start & 0xFF);
                memset(temp_buf, 0xFF, block_start & 0xFF);
-               memcpy(temp_buf + (block_start & 0xFF), buf, len);
+               memcpy(temp_buf + (block_start & 0xFF), buf, len - (block_start & 0xFF));
                block_start &= ~0xFF;
-       } else memcpy(temp_buf, buf, len);
+       } else {
+               memcpy(temp_buf, buf, len);
+       }
        
        UsbCommand c = {CMD_SETUP_WRITE};
 
Impressum, Datenschutz