about summary refs log tree commit diff
path: root/src/engine/packet.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/packet.h')
-rw-r--r--src/engine/packet.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/engine/packet.h b/src/engine/packet.h
index 79c969c2..1dd3c3ab 100644
--- a/src/engine/packet.h
+++ b/src/engine/packet.h
@@ -1,4 +1,5 @@
 #include <stdarg.h>
+#include <string.h>
 #include <baselib/stream/file.h>
 #include <baselib/network.h>
 
@@ -273,6 +274,9 @@ public:
 	
 	int get_int()
 	{
+		if(current >= end)
+			return 0;
+			
 		int i;
 		current = vint_unpack(current, &i);
 		// TODO: might be changed into variable width
@@ -285,6 +289,9 @@ public:
 	
 	const char *get_string()
 	{
+		if(current >= end)
+			return "";
+			
 		// TODO: add range check
 		// TODO: add debug marker
 		const char *ptr = (const char *)current;