From b6b2f911500c2e7d80dc14a148710986272da609 Mon Sep 17 00:00:00 2001
From: Nikias Bassen
Date: Thu, 29 Jul 2010 23:25:36 +0200
Subject: property_list_service: fix plist receiving on big endian machines

---
 src/property_list_service.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/property_list_service.c b/src/property_list_service.c
index 80b5f52..5c6d2bd 100644
--- a/src/property_list_service.c
+++ b/src/property_list_service.c
@@ -226,10 +226,10 @@ static property_list_service_error_t internal_plist_receive_timeout(property_lis
 		debug_info("initial read failed!");
 		return PROPERTY_LIST_SERVICE_E_MUX_ERROR;
 	} else {
-		if ((char)pktlen == 0) { /* prevent huge buffers */
+		pktlen = GUINT32_FROM_BE(pktlen);
+		if (pktlen < (1 << 24)) { /* prevent huge buffers */
 			uint32_t curlen = 0;
 			char *content = NULL;
-			pktlen = GUINT32_FROM_BE(pktlen);
 			debug_info("%d bytes following", pktlen);
 			content = (char*)malloc(pktlen);
 
-- 
cgit v1.1-32-gdbae