Commit 4cb516749ac9294a46b898c85b84111d7fd34773

Con Kolivas 2013-11-22T09:58:30

Only check strlen on end if end exists.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/usbutils.c b/usbutils.c
index 1974cad..ee8e713 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -2522,12 +2522,15 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
 	unsigned int initial_timeout;
 	int bufleft, err, got, tot, pstate;
 	bool first = true;
-	int endlen = strlen(end);
+	int endlen = 0;
 	unsigned char *ptr, *usbbuf = cgpu->usbinfo.bulkbuf;
 	const size_t usbbufread = 512; /* Always read full size */
 	char *eom = NULL;
 	double done;
 
+	if (end)
+		endlen = strlen(end);
+
 	DEVRLOCK(cgpu, pstate);
 
 	if (cgpu->usbinfo.nodev) {