From 4cdcf414dec822c11821a59a3d1346e33b98f3a1 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 13 Jul 2008 11:29:26 -0400 Subject: [PATCH] Add a call to NSAssert() to stop us if we receive incomplete packets from SocketWrapper * Source/SocketWrapper.m: (receive): Assert that the packet is a complete XML document --- Source/SocketWrapper.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/SocketWrapper.m b/Source/SocketWrapper.m index e74235a..21c52e2 100644 --- a/Source/SocketWrapper.m +++ b/Source/SocketWrapper.m @@ -223,7 +223,11 @@ } NSString *tmp = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; // strip whitespace - return [tmp substringToIndex:[tmp length] - 1]; // don't want the null byte + tmp = [tmp substringToIndex:[tmp length] - 1]; // don't want the null byte + + NSAssert([tmp UTF8String][[tmp length] - 1] == '>', @"-[SocketWrapper receive] buffer is incomplete"); + + return tmp; } /** -- 2.22.5