From 9e745d180199d39249305275bdc5242634671238 Mon Sep 17 00:00:00 2001
From: Zach C
Date: Wed, 30 Jul 2008 20:38:36 -0700
Subject: Fixed a slight bug if datalen == bytes in usbmux.c

---
 src/usbmux.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/usbmux.c b/src/usbmux.c
index 8c5fc34..7985b3a 100644
--- a/src/usbmux.c
+++ b/src/usbmux.c
@@ -187,7 +187,8 @@ int mux_recv(iPhone *phone, usbmux_tcp_header *connection, char *data, uint32 da
 	} else {// all's good, they didn't do anything bonky.
 		my_datalen = ntohl(buffer[4]) - 28; 
 		connection->ocnt += my_datalen;
-		memcpy(data, buffer+28, datalen); 
+		if (bytes == (datalen+28)) memcpy(data, buffer+28, datalen); 
+		else if (bytes == datalen) memcpy(data, buffer+28, datalen-28);
 		free(buffer);
 		if (debug) printf("mux_recv: bytes received: %i\n", bytes - 28);
 		return bytes - 28;
-- 
cgit v1.1-32-gdbae