Commit 0e8028fc294bdfd18c7ccdd00a3373b5b9914b0c

Kano 2013-09-22T19:59:29

usbutils saving incorrect overflow buffer

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/usbutils.c b/usbutils.c
index a556411..9312a1f 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -2757,7 +2757,7 @@ int _usb_read(struct cgpu_info *cgpu, int epinfo, char *buf, size_t bufsiz, int 
 		// N.B. usbdev->buffer was emptied before the while() loop
 		if (usbdev->buffer && tot > (int)bufsiz) {
 			usbdev->bufamt = tot - bufsiz;
-			memcpy(usbdev->buffer, ptr + bufsiz, usbdev->bufamt);
+			memcpy(usbdev->buffer, usbbuf + bufsiz, usbdev->bufamt);
 			tot -= usbdev->bufamt;
 			usbbuf[tot] = '\0';
 			applog(LOG_ERR, "USB: %s%i read1 buffering %d extra bytes",